如何在Fabric中定义包装器函数?

2024-03-28 22:16:12 发布

您现在位置:Python中文网/ 问答频道 /正文

考虑这个简单的结构文件:

def wrapper():
    f1()
    f2()

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

@hosts([host2])
def f2():
    run('uname')

通过运行fab wrapper,您将得到以下提示:

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

如何使wrapper()忽略任何主机,并假定所有子任务都将处理该方面?在


Tags: 文件norundefwrapper结构lsf2