From: Zack Cerza Date: Tue, 9 Sep 2014 23:55:08 +0000 (-0600) Subject: In Remote.run(), attempt to reconnect if necessary X-Git-Tag: 1.1.0~1179 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dc6020b2132c155ed07d52efff44fd88e128c2e3;p=teuthology.git In Remote.run(), attempt to reconnect if necessary Signed-off-by: Zack Cerza --- diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index 02c1800c8..12b5f1122 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -60,9 +60,10 @@ class Remote(object): Attempts to re-establish connection. Returns True for success; False for failure. """ - self.ssh.close() + if self.ssh is not None: + self.ssh.close() try: - self.ssh = self.connect() + self.connect() return self.is_online except Exception as e: log.debug(e) @@ -111,6 +112,8 @@ class Remote(object): TODO refactor to move run.run here? """ + if self.ssh is None: + self.reconnect() r = self._runner(client=self.ssh, name=self.shortname, **kwargs) r.remote = self return r @@ -188,7 +191,7 @@ class Remote(object): raise NotImplementedError("sudo not supported") self._sftp_put_file(path, dest_path) - return + return def get_file(self, path, sudo=False, dest_dir='/tmp'): """