fab-user
[Top][All Lists]
Advanced

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

Re: [Fab-user] return_code for run operation in fabric 0.9.2


From: Jeff Forcier
Subject: Re: [Fab-user] return_code for run operation in fabric 0.9.2
Date: Thu, 16 Sep 2010 07:54:29 -0400

I guess you didn't read the tutorial? ;)

    http://docs.fabfile.org/0.9.2/tutorial.html#failure-handling

You just need to make use of the warn_only setting; it's typically
best paired with the "with settings():" context manager.

HTH,
Jeff

On Thu, Sep 16, 2010 at 2:55 AM, Robert Forkel <address@hidden> wrote:
> hi all,
> i needed to run shell commands which returned non-0 return codes (on
> success), so i had to patch operations.py (see below). is this
> something which will be possible in fabric 1.x?
> best regards,
> robert
>
> --- operations_old.py   2010-09-16 08:52:55.000000000 +0200
> +++ operations.py       2010-09-16 08:42:07.000000000 +0200
> @@ -373,7 +373,7 @@
>
>
> address@hidden
> -def run(command, shell=True, pty=False):
> +def run(command, shell=True, pty=False, return_code=0):
>     """
>     Run a shell command on a remote host.
>
> @@ -443,7 +443,7 @@
>
>     # Error handling
>     out.failed = False
> -    if status != 0:
> +    if status != return_code:
>         out.failed = True
>         msg = "run() encountered an error (return code %s) while
> executing '%s'" % (status, command)
>         _handle_failure(message=msg)
>
> _______________________________________________
> 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]