Python Fabric - No hosts found. Please specify (single) host string for connection:

后端 未结 3 1488
南笙
南笙 2021-02-13 00:50

How do I get No hosts found. Please specify (single) host string for connection: ?

How to a resolve with fabric?

def bootstrap():
    host = \'ec2-54-xx         


        
3条回答
  •  逝去的感伤
    2021-02-13 00:58

    Instead of setting hosts inside your task, do it before it gets called with a decorator:

    from fabric.api import hosts, env
    
    @hosts(['ec2-54-xxx.xxx.xxx.compute-1.amazonaws.com'])
    def bootstrap():
        env.user = "ubuntu"
        env.key_filename = "/home/ubuntu/omg.pem"
    

    For more information on this, check out Defining host lists - there are a lot of different ways to do it depending on what you need.

提交回复
热议问题