I don't know if I'm doing something wrong but it would not work for me. Consider this fabfile.py:
from fabric.api import * @hosts('1.1.1.1') def deploy_one(): run('this on 1') @hosts('2.2.2.2') def deploy_two(): run('that on 2') def deploy(): deploy_one() deploy_two() Well, if I run ``fab deploy`` it will complain about missing host definition for the task ``deploy``: $ fab deploy No hosts found. Please specify (single) host string for connection: I have looked all over the web only to find everyone would be running ``fab deploy_one deploy_two``. Which is not what I want. How can I make the script work? Thanks Jiri Christian Vest Hansen wrote: > Tasks are just python functions. You can create a task `deploy` like > this, for instance: > > def deploy(): > deploy_db() > deploy_app() > deploy_daemons() > deploy_queue() > > On Fri, Jan 29, 2010 at 3:54 PM, Jiri Barton <j...@hosting4u.cz> wrote: >> Hi, >> >> I was wondering if there is a way to group tasks and then refer to the >> group by one name. I don't want to start but sort of what namespaces in >> Capistrano could be used for. >> >> What I'm trying to do is to deploy to several machines which are domain >> specific. I have a database machine, a web server with the application >> code, a machine which runs daemons, and a machine for command queuing. >> Of course, each machine has specific needs and it would be more fitting >> if I defined different fabric tasks for each of them, like: >> >> def deploy_db(): >> #migrate the db schema >> >> def deploy_app(): >> #restart web server >> >> def deploy_daemons(): >> #restart all app daemons >> >> def deploy_queue(): >> #restart the queuing manager >> >> Now, what I have to do is >> >> fab deploy_db deploy_app deploy_daemons deploy_queue >> >> What I had rather do is >> >> fab deploy >> >> This would call those four tasks from above. >> >> >> The reason for that is the deployment plan - the order in which the >> deployment tasks are run - hardly ever changes but the order of the >> tasks is essential. Sometimes I need to restart some services on other >> machines and so this deployment plan changes. >> >> Is there a way? >> >> Thanks >> Jiri >> >> >> >> >> >> _______________________________________________ >> Fab-user mailing list >> Fab-user@nongnu.org >> http://lists.nongnu.org/mailman/listinfo/fab-user >> > > > _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user