SSHHost.ssh_ping() now catches the timeout error that can be thrown by run() and raises it again with a descriptive message.

From: Travis Miller



git-svn-id: http://test.kernel.org/svn/autotest/trunk@1485 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/server/hosts/ssh_host.py b/server/hosts/ssh_host.py
index 158becf..1da7bc2 100644
--- a/server/hosts/ssh_host.py
+++ b/server/hosts/ssh_host.py
@@ -25,7 +25,6 @@
 import remote, bootloader
 
 
-
 class SSHHost(remote.RemoteHost):
 	"""
 	This class represents a remote machine controlled through an ssh 
@@ -747,7 +746,14 @@
 
 
 	def ssh_ping(self, timeout = 60):
-		self.run('true', timeout = timeout, connect_timeout = timeout)
+		try:
+			self.run('true', timeout = timeout, connect_timeout = timeout)
+		except error.AutoservSSHTimeout:
+			msg = "ssh ping timed out. timeout = %s" % timeout
+			raise error.AutoservSSHTimeout(msg)
+		except error.AutoservRunError:
+			msg = "command true failed in ssh ping"
+			raise error.AutoservRunError(msg)
 
 
 	def get_autodir(self):