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_2_staging():
  deploy('staging')
def deploy_2_prod():
  deploy('prod')
def deploy(server):
  print 'env.hosts:', env.hosts
  env.hosts = [server]
  print 'env.hosts:', env.hosts
Sample output:
host:folder user$ fab deploy_2_dev
env.hosts: []
env.hosts: ['dev']
No hosts found. Please specify (single) host string for connection:
When I create a set_hosts() task as shown in the Fabric docs, env.hosts is set properly. However, this is not a viable option, neither is a decorator. Passing hosts on the command line would ultimately result in some kind of shell script that calls the fabfile, I would prefer having one single tool do the job properly.
It says in the Fabric docs that 'env.hosts is simply a Python list object'. From my observations, this is simply not true.
Can anyone explain what is going on here ? How can I set the host to deploy to ?
 
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
    