开发者

How do you define a wrapper function in Fabric?

开发者 https://www.devze.com 2023-03-27 19:49 出处:网络
Consider this simple fabric file: def wrapper(): f1() f2() @hosts([host1]) def f1(): run(\'ls\') @hosts([host2])

Consider this simple fabric file:

def wrapper():
    f1()
    f2()

@hosts([host1])
def f1():
    run('ls')

@hosts([host2])
def f2():
   开发者_如何学JAVA run('uname')

By running fab wrapper you get a prompt for:

No hosts found. Please specify a (single) host string for connection:

How can I make wrapper() ignore any hosts, and assume all sub-tasks will handle that aspect?


Fabric issue #21 deals with this longstanding problem.

execute() now supports this behavior.

0

精彩评论

暂无评论...
验证码 换一张
取 消