On Wed, May 16, 2012 at 2:11 PM, Dan Craig <[email protected]> wrote: > def deploy(): > execute(operate_on_web) > execute(operate_on_db) > > But when I run "fab cluster_without_db deploy", it still executes > operate_on_db, even though there are no hosts in the 'db' roledef. I had > expected it to not execute at all. Am I doing something wrong, or is this > the way it's supposed to work?
I assume that it runs and probably then prompts you for a host since it has an empty host list? If so, yes, that is how it's supposed to work -- there's no "skip a task that has no valid hosts" logic (otherwise your cluster setup tasks wouldn't even work, for example, as they have no hosts set for them either.) If you want deploy() to skip running the DB subtask when there's no DB role, you could simply wrap the 2nd execute() in an 'if' statement, e.g. "if 'db' in env.roledefs: execute(...)". Best, Jeff -- Jeff Forcier Unix sysadmin; Python/Ruby engineer http://bitprophet.org _______________________________________________ Fab-user mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/fab-user
