fab-user
[Top][All Lists]
Advanced

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

[Fab-user] Noob not quite understanding roles . . .


From: address@hidden
Subject: [Fab-user] Noob not quite understanding roles . . .
Date: Thu, 23 Sep 2010 16:17:55 -0400

Hi,

I must not understand the usage of roles. Given:

from fabric.api import *
from fabric.state import output
from fabric.decorators import roles

env.hosts = ['address@hidden:22','address@hidden:7722','address@hidden ','address@hidden']
env.roledefs = {
'deploy': ['address@hidden:22','address@hidden:7722','address@hidden '],
    'stage': ['address@hidden'],
}
env.key_filename = '/path/to/known_hosts'

def pack():
    """do some local stuff"""
    print("Executing pack on %(host)s as %(user)s" % env)

@roles('stage')
def update_staging():
    """update the staging server"""
    print("Executing update_staging on %(host)s as %(user)s" % env)

@roles('deploy')
def update_production():
    """update the production servers"""
    print("Executing update_production on %(host)s as %(user)s" % env)

def go():
    pack()
    update_staging()
    update_production()


I would expect update_staging to only be acted on by the 'stage' roledef and the update_production by the 'deploy' roledef.

Any help would be very appreciated:)






reply via email to

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