1. Removed the system() and system_output() implementations from client/bin/autotest_utils.py so that the ones in common_lib/utils.py are used throughout.
2. Add an optional parameter to system_output() in client/common_lib/utils.py to retain stdout and not throw it away.
3. Renamed ignorestatus to ignore_status to make it consistent with the rest of the code.
4. Modified the tests to use the renamed ignore_status option
5. Modifed the CmdError() implementation in client/common_lib/error.py and made sure all the places on the server side, that expect a AutoservRunError exception are changed to expect and handle a CmdError exception instead.

Signed-off-by: Ashwin Ganti <aganti@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1499 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index f6391d3..fafd409 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -327,7 +327,13 @@
 		env = " ".join("=".join(pair) for pair in self.env.iteritems())
 		full_cmd = '%s "%s %s"' % (self.ssh_command(connect_timeout),
 		                           env, utils.sh_escape(command))
-		result = utils.run(full_cmd, timeout, True, stdout, stderr)
+		try:
+			result = utils.run(full_cmd, timeout, True, stdout, stderr)
+		# we get a CmdError here only if there is timeout of that command.
+		# Catch that and stuff it into AutoservRunError and raise it.
+		except error.CmdError, cmderr:
+			raise error.AutoservRunError(cmderr.args[0], cmderr.args[1])
+
 		if result.exit_status == 255:  # ssh's exit status for timeout
 			if re.match(r'^ssh: connect to host .* port .*: ' +
 			            r'Connection timed out\r$', result.stderr):