fab-user
[Top][All Lists]
Advanced

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

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


From: Robert Forkel
Subject: [Fab-user] return_code for run operation in fabric 0.9.2
Date: Thu, 16 Sep 2010 08:55:07 +0200

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)



reply via email to

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