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 <xrotw...@googlemail.com> 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 @@
>
>
> �...@needs_host
> -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
> Fab-user@nongnu.org
> http://lists.nongnu.org/mailman/listinfo/fab-user
>



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

_______________________________________________
Fab-user mailing list
Fab-user@nongnu.org
http://lists.nongnu.org/mailman/listinfo/fab-user

Reply via email to