]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Remote instances can now establish SSH connections
authorZack Cerza <zack@cerza.org>
Mon, 10 Feb 2014 19:57:53 +0000 (13:57 -0600)
committerZack Cerza <zack@cerza.org>
Thu, 20 Feb 2014 23:46:07 +0000 (17:46 -0600)
Previously, they required an active ssh connection object to be passed
to them. That behavior is still functional.

Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
teuthology/orchestra/remote.py

index b50c1100adacf74f33df891ad6c6a382ad038e26..f38fccae53276d127191edec41b5e96568464c56 100644 (file)
@@ -2,6 +2,7 @@
 Support for paramiko remote objects.
 """
 from . import run
+from .connection import connect
 from teuthology import misc
 import time
 import pexpect
@@ -28,11 +29,20 @@ class Remote(object):
     # for unit tests to hook into
     _runner = staticmethod(run.run)
 
-    def __init__(self, name, ssh, shortname=None, console=None):
+    def __init__(self, name, ssh=None, shortname=None, console=None, host_key=None,
+                 keep_alive=True):
         self.name = name
         self._shortname = shortname
-        self.ssh = ssh
+        self.host_key = host_key
+        self.keep_alive = keep_alive
         self.console = console
+        if ssh is None:
+            ssh = self._connect()
+        self.ssh = ssh
+
+    def _connect(self):
+        return connect(user_at_host=self.name, host_key=self.host_key,
+                       keep_alive=self.keep_alive)
 
     @property
     def shortname(self):