Have the autotest server run the client by calling host.run, instead
of explicitly doing it through ssh. Also, make sure that when
SSHHost does run commands through run it logs the commands being run
and passed on the output to stdout and stderr.

This also disables X11 forwarding in ssh (the -x option) to since we
don't use it and it may just introduce a lot of spurious "remote host
denied forwarding" warnings into the logs.

Signed-off-by: John Admanski <jadmanski@google.com>



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1002 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index 4b18504..b62cfb3 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -44,7 +44,8 @@
 	implement the unimplemented methods in parent classes.
 	"""
 
-	SSH_BASE_COMMAND = '/usr/bin/ssh -a -o BatchMode=yes -o ConnectTimeout=30'
+	SSH_BASE_COMMAND = '/usr/bin/ssh -a -x -o ' + \
+			   'BatchMode=yes -o ConnectTimeout=30'
 	DEFAULT_REBOOT_TIMEOUT = 1800
 	job = None
 
@@ -314,7 +315,8 @@
 					       self.hostname)
 
 
-	def run(self, command, timeout=None, ignore_status=False):
+	def run(self, command, timeout=None, ignore_status=False,
+		stdout_tee=None, stderr_tee=None):
 		"""
 		Run a command on the remote host.
 		
@@ -334,10 +336,14 @@
 			AutoservRunError: the exit code of the command 
 				execution was not 0
 		"""
-		#~ print "running %s" % (command,)
-		result= utils.run(r'%s "%s"' % (self.ssh_command(),
-						utils.sh_escape(command)),
-						timeout, ignore_status)
+		stdout = stdout_tee or sys.stdout
+		stderr = stderr_tee or sys.stderr
+		print "On host %s running %s" % (self.hostname, command)
+		env = " ".join("=".join(pair) for pair in self.env.iteritems())
+		full_cmd = '%s "%s %s"' % (self.ssh_command(), env,
+					   utils.sh_escape(command))
+		result = utils.run(full_cmd, timeout, ignore_status,
+				   stdout, stderr)
 		return result