env.roledefs = {
'seed': ['host1'],
'peer': ['host2']
}
@roles('seed')
def test():
pass
@roles('peer')
def test1():
pass
def deploy():
test()
test1()
fab test, fab test1 - all ok
fab deploy:
No hosts found. Please specify (single) host string for connection:
Why ?
When calling test
and test1
from deploy
, the @roles
are not taken into account. You should call the functions using execute(test)
and execute(test1)
.
See also:
Because env.hosts is not set. Your test() functions do not use run() or any similar command that requires ssh connection, while deploy(), presumably, does().
Read these first:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.