Risk: Medium
Visibility: Should improve error messages from failing commands.
This converts the CmdErrors raised by run to something more useful.
It seems that the original command failure code that actually told
you what command actually failed got excised during the big merge
of all of our system/system_output/run stuff until a single common
lib run function.
It also clears out a bunch of the util stubs in server utils, since
the fixes made them mostly unnecessary.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1572 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/client/common_lib/utils.py b/client/common_lib/utils.py
index 71cac1e..c9e8370 100644
--- a/client/common_lib/utils.py
+++ b/client/common_lib/utils.py
@@ -165,8 +165,8 @@
CmdError: the exit code of the command
execution was not 0
"""
- return join_bg_job(run_bg(command), timeout, ignore_status,
- stdout_tee, stderr_tee)
+ return join_bg_job(run_bg(command), command, timeout, ignore_status,
+ stdout_tee, stderr_tee)
def run_bg(command):
@@ -178,7 +178,7 @@
return sp, result
-def join_bg_job(bg_job, timeout=None, ignore_status=False,
+def join_bg_job(bg_job, command, timeout=None, ignore_status=False,
stdout_tee=None, stderr_tee=None):
"""Join the subprocess with the current thread. See run description."""
sp, result = bg_job
@@ -210,10 +210,11 @@
if result.exit_status != 0:
if timeouterr:
- raise error.CmdError('Command not complete within'
- ' %s seconds' % timeout, result)
+ raise error.CmdError(command, result, "Command did not "
+ "complete within %d seconds" % timeout)
elif not ignore_status:
- raise error.CmdError("command execution error", result)
+ raise error.CmdError(command, result,
+ "Command returned non-zero exit status")
return result