Get the current value of env.hosts list with Python Fabric Library

前端 未结 3 1053
感情败类
感情败类 2021-01-01 12:22

I\'ve got this code (foo and bar are local servers):

env.hosts = [\'foo\', \'bar\']

def mytask():
    print(env.hosts[0])
<         


        
3条回答
  •  一个人的身影
    2021-01-01 12:43

    Thanks Marcelo.

    If you want to actually use env.host_string (for concatenation purpose for instance), be sure to be inside a task. Its value is None outside.

提交回复
热议问题