fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] using execute fabric command does not work as expected


From: Jeff Forcier
Subject: Re: [Fab-user] using execute fabric command does not work as expected
Date: Fri, 13 Sep 2013 13:33:42 -0700

Please check the usage docs on the execution model - I think what you
want is to remove @roles from your function and instead give the inner
execute() calls 'role='staging'.

By putting @roles on stage() you're telling Fabric to run that task
once per host in the role's runlist - instead you want stage() itself
to just run one time "locally" and for the inner execute()s to handle
connecting per-subtask. Thus the role= kwarg to execute().

On Fri, Sep 13, 2013 at 4:23 AM, Alexander Kolev <address@hidden> wrote:
> Hi,
>
>
>
> I’m using Fabric 1.7, Python 2.7. This is part of my fabfile.py file
>
>
>
> env.roledefs = {
>
>     "dev" : ["dev01 "],
>
>     "staging" : ["sta01 ", "sta02"],
>
>     "live" : ["live01", "live02"]
>
>
>
> @roles("staging")
>
> def stage(application=""):
>
>     execute(create_package)
>
>     execute(copy_package)
>
>     execute(run_package)
>
>     execute(email_result)
>
>
>
>
>
> When I call fab stage:appname, it runs the four functions first on sta01 and
> then on sta02.
>
>
>
> Sta01: create_package
>
> Sta01: copy_package
>
> Sta01: run_package
>
> Sta01: email_result
>
>
>
>
>
> Sta02: create_package
>
> Sta02: copy_package
>
> Sta02: run_package
>
> Sta02: email_result
>
>
>
>
>
> Expected result is executing each function on sta01 and sta02, and then
> continue with next function:
>
>
>
> Sta01: create_package
>
> Sta02: create_package
>
>
>
>
>
> Sta01: copy_package
>
> Sta02: copy_package
>
>
>
> Sta01: run_package
>
> Sta02: run_package
>
>
>
> Sta01: email_result
>
> Sta02: email_result
>
>
>
>
>
> What is wrong with my script?
>
>
>
>
>
> Regards,
>
> Alex
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Fab-user mailing list
> address@hidden
> https://lists.nongnu.org/mailman/listinfo/fab-user
>



-- 
Jeff Forcier
Unix sysadmin; Python/Ruby engineer
http://bitprophet.org



reply via email to

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