fab-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fab-user] Executing a task with an empty roledef


From: Dan Craig
Subject: [Fab-user] Executing a task with an empty roledef
Date: Wed, 16 May 2012 17:11:00 -0400

Hi all,

I have a fabfile that I use for deployment (using Fabric 1.4.2) to a few different clusters, some of which have certain roles that need action on and others don't.  My fabfile is something like this, with one cluster than has a database role and another that doesn't.

def cluster_one():
    env.roledefs = {'web': ['www1', 'www2'], 'db': ['db']}

def cluster_without_a_db():
    env.roledefs = {'web': ['www3'], 'db': []}

@roles('web')
def operate_on_web():
    run('....')

@roles('db')
def operate_on_db():
    run('....')

def deploy():
    execute(operate_on_web)
    execute(operate_on_db)

Now, when I run "fab cluster_one deploy" things happen as expected, with the operate_on_web running on the web roles, and operate_on_db runnign on the db role. 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?

Thanks,

Dan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]