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, [email protected]
<[email protected]> 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 =
> ['us...@remotesever1:22','us...@remoteserver2:7722','us...@remoteserver3','us...@remoteserver4']
> env.roledefs = {
> 'deploy':
> ['us...@remotesever1:22','us...@remoteserver2:7722','us...@remoteserver3'],
> 'stage': ['us...@remoteserver4'],
> }
> 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
> [email protected]
> http://lists.nongnu.org/mailman/listinfo/fab-user
>
--
Jeff Forcier
Unix sysadmin; Python/Ruby developer
http://bitprophet.org
_______________________________________________
Fab-user mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/fab-user