我有一个如下的fabfile:
@hosts('host1')
def host1_deploy():
"""Some logic that is specific to deploying to host1"""
@hosts('host2')
def host2_deploy():
"""Some logic that is specific to deploying to host2"""
def deploy():
""""Deploy to both hosts, each using its own logic"""
host1_deploy()
host2_deploy()
我想要做
fab deploy
并让它等价于
fab host1_deploy host2_deploy
换句话说,运行每个子任务并为每个子任务使用它指定的主机列表。但是,这不起作用。相反,deploy() 任务需要它自己的主机列表,它将传播给它的所有子任务。
有没有办法在这里更新 deploy() 任务,这样它就可以做我想做的事情,同时不理会子任务,以便它们可以单独运行?