From 71b4bfe22633d4ff829ae4cde15fe01ca10c3ca2 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Mon, 10 Feb 2014 13:57:53 -0600 Subject: [PATCH] Remote instances can now establish SSH connections Previously, they required an active ssh connection object to be passed to them. That behavior is still functional. Signed-off-by: Zack Cerza --- teuthology/orchestra/remote.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/teuthology/orchestra/remote.py b/teuthology/orchestra/remote.py index b50c1100ad..f38fccae53 100644 --- a/teuthology/orchestra/remote.py +++ b/teuthology/orchestra/remote.py @@ -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): -- 2.39.5