fab-user
[Top][All Lists]
Advanced

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

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


From: hunterCreative
Subject: Re: [Fab-user] Noob not quite understanding roles . . .
Date: Fri, 24 Sep 2010 17:29:50 -0400

Thanks Jeff!

After making it over that hurdle I am now on to other 'fabric' stuff -thanks 
for this!


--Brian

On Sep 23, 2010, at 4:54 PM, Jeff Forcier wrote:

> Hi Brian,
> 
> This is a common misconception, though it's more due to Fabric's
> simplistic execution model than anything else (and something we'll be
> addressing in the future).
> 
> Here's a recent explanation of the issue:
> 
>    http://lists.nongnu.org/archive/html/fab-user/2010-09/msg00008.html
> 
> -Jeff
> 
> On Thu, Sep 23, 2010 at 4:17 PM, address@hidden
> <address@hidden> wrote:
>> 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:)
>> 
>> 
>> 
>> 
>> _______________________________________________
>> Fab-user mailing list
>> address@hidden
>> http://lists.nongnu.org/mailman/listinfo/fab-user
>> 
> 
> 
> 
> -- 
> Jeff Forcier
> Unix sysadmin; Python/Ruby developer
> http://bitprophet.org




reply via email to

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