How to set target hosts in Fabric file

后端 未结 15 730
南方客
南方客 2020-11-29 15:27

I want to use Fabric to deploy my web app code to development, staging and production servers. My fabfile:

def deploy_2_dev():
  deploy(\'dev\')

def deploy_         


        
15条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 15:46

    You need to set host_string an example would be:

    from fabric.context_managers import settings as _settings
    
    def _get_hardware_node(virtualized):
        return "localhost"
    
    def mystuff(virtualized):
        real_host = _get_hardware_node(virtualized)
        with _settings(
            host_string=real_host):
            run("echo I run on the host %s :: `hostname -f`" % (real_host, ))
    

提交回复
热议问题