]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Tweaks to is_online and reconnect()
authorZack Cerza <zack@cerza.org>
Mon, 10 Feb 2014 23:26:51 +0000 (17:26 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 20 Feb 2014 23:46:07 +0000 (17:46 -0600)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/orchestra/remote.py

index 8df6f221ba7c109ec4ac89f2bc52ba97030daf30..7d353c36416bff5e0f1ef95a3af1f1dedf4e0bf8 100644 (file)
@@ -48,8 +48,16 @@ class Remote(object):
         return self.ssh
 
     def reconnect(self):
+        """
+        Attempts to re-establish connection. Returns True for success; False
+        for failure.
+        """
         self.ssh.close()
-        self.ssh = self.connect()
+        try:
+            self.ssh = self.connect()
+            return self.is_online
+        except Exception:
+            return False
 
     @property
     def shortname(self):
@@ -67,10 +75,12 @@ class Remote(object):
 
     @property
     def is_online(self):
+        if self.ssh is None:
+            return False
         try:
             self.run(args="echo online")
         except Exception:
-            pass
+            return False
         return self.ssh.get_transport().is_active()
 
     @property