Add ignorestatus=1 to ssh_host.run
Signed-off-by: Ryan Stutsman <stutsman@google.com>
This adds an option to Host.run and utils.run to suppress exceptions.
This keeps one from having to perpetually catch exceptions if several
commands that may potentially fail have to be run.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@586 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/utils.py b/server/utils.py
index ea860f5..47e0927 100644
--- a/server/utils.py
+++ b/server/utils.py
@@ -129,7 +129,7 @@
return tmpfile
-def run(command, timeout=None):
+def run(command, timeout=None, ignore_status=False):
"""Run a command on the host.
Args:
@@ -215,8 +215,8 @@
result.exit_status= exit_status_indication / 256
result.stdout += sp.stdout.read()
result.stderr = sp.stderr.read()
-
- if result.exit_status > 0:
+
+ if not ignore_status and result.exit_status > 0:
raise errors.AutoservRunError("command execution error",
result)