Some frequents tasks require running some commands on specific hosts (not on 
every host). An easy example could be migrating a database or deploying 
different parts of the application on different hosts.

My first idea was changing the value of 'fab_hosts' as needed, but as far as I 
understand 'fab_hosts' is populated only the first time. So with this fabfile, 

 def hostname():
     set( fab_hosts = ['webserver',] )
     run("hostname")
  
 def hostname_full():
     set( fab_hosts = ['dbserver',] )
     run("hostname -f")

...this would return the name of both hosts:

  $ fab hostname ; fab hostname_full

...but this will return the name of 'webserver', just twice:

  $ fab hostname hostname_full

Did someone find a way to do this in a single step? I mean, invoking fabric 
just once. Some processes like migrating a database to another host are far 
easier to implement if I can build an atomic script ("dumping the database on 
host A failed, don't try to upload it to host B").

I'm on fabric-0.0.9 (via Pypi). I suspect my question is related with the 
Capistrano-like roles feature that's been discussed before, but I'm not sure 
what the plans are about it.
-- 
##############################
### Jordi Funollet
### http://www.terraquis.net



_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to