我有一个用@roles
修饰的任务,我偶尔想在单个主机上运行(对于canary测试部署)。在
from fabric.api import *
env.roledefs = {
'web-workers': ['django@worker1', 'django@worker2'],
'some-other-role': ['django@worker2'],
}
@task
@roles('web-workers')
def bogomips():
run('uptime')
docs for ^{
...barring an override on the command line, my_func will be executed against the hosts listed [in the role]...
但是我不能让这里提到的“覆盖”功能工作。。。我试过:
^{pr2}$但它总是在decorator中提到的整个角色上执行。。。在
我错过了什么?如何覆盖@roles
修饰任务的运行位置?在
根据Execution model's Order of Precedence,这实际上是预期的行为,在这个场景中必须使用稍微不同的语法。在
下面是一个不起作用的命令:
这个版本就是这样的:
^{pr2}$问题是:#308: @roles and @hosts decorators ignore command line options
还有文件:http://docs.fabfile.org/en/1.0.0/usage/execution.html#order-of-precedence
相关问题 更多 >
编程相关推荐