Hi Aaron, On Thu, Oct 29, 2009 at 8:17 AM, Aaron Ross <aa...@wawd.com> wrote:
> Is there a way to call a command from another command that will pay > attention to the already defined roles/hosts? > Thanks, Right now, short answer, not quite. See the usage docs on the current execution model for why this is: http://docs.fabfile.org/0.9/usage/execution.html (the whole document, but specifically the "Execution strategy" and "Connections" sections) and note that it's not by any means set in stone, as evidenced by this ticket: http://code.fabfile.org/issues/show/21 For a short-term solution: if your intended pairing of sub-tasks to host lists is fully commutative (i.e. if it's OK for db_backup(), restart() etc to run on the 'code' role) then the easiest thing is to move the @roles to wrap the task you're actually calling, in this case release(). Otherwise, depending on your exact needs, just make sure you're aware of that execution model and try to work with it, e.g.:: # Make sure no host lists are specified anywhere else, and then e.g.: def release(): [...] for host in env.roledefs['code']: with settings(host_string=host): update() Again, see ticket 21 for some basic thoughts on how this can be improved, and feel free to add comments with specific needs/ideas. Best, Jeff _______________________________________________ Fab-user mailing list Fab-user@nongnu.org http://lists.nongnu.org/mailman/listinfo/fab-user