From 778d930d0885bb894f77d698d6b1f3b5d3bf8346 Mon Sep 17 00:00:00 2001 From: Warren Usui Date: Tue, 18 Jun 2013 14:23:22 -0700 Subject: [PATCH] Fix to ignore ssh-key checking if running on virtual machines or if a line that reads 'sshkey: ignore' is in the yaml file. Fix #5364 Signed-off-by: Warren Usui --- teuthology/misc.py | 4 ---- teuthology/orchestra/connection.py | 2 ++ teuthology/task/internal.py | 18 ++++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/teuthology/misc.py b/teuthology/misc.py index f5e7793e40aec..d7fb2e5d94302 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -727,10 +727,6 @@ def reconnect(ctx, timeout, remotes=None): try: log.info('trying to connect to %s', remote.name) key = ctx.config['targets'][remote.name] - if is_vm(remote.name): - kstat = lockstatus.get_status(ctx,remote.name) - if 'sshpubkey' in kstat: - key = kstat['sshpubkey'] from .orchestra import connection remote.ssh = connection.connect( user_at_host=remote.name, diff --git a/teuthology/orchestra/connection.py b/teuthology/orchestra/connection.py index c769411db6751..2473c19b1480e 100644 --- a/teuthology/orchestra/connection.py +++ b/teuthology/orchestra/connection.py @@ -24,6 +24,8 @@ def connect(user_at_host, host_key=None, keep_alive=False, if _SSHClient is None: _SSHClient = paramiko.SSHClient ssh = _SSHClient() + if host_key is None: + ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) if _create_key is None: _create_key = create_key diff --git a/teuthology/task/internal.py b/teuthology/task/internal.py index ebe9edcbefd2c..dae1217d35937 100644 --- a/teuthology/task/internal.py +++ b/teuthology/task/internal.py @@ -176,15 +176,17 @@ def connect(ctx, config): machs = [] for name in ctx.config['targets'].iterkeys(): machs.append(name) - lock.scan_for_locks(ctx, machs) - for t, xkey in ctx.config['targets'].iteritems(): + for t, key in ctx.config['targets'].iteritems(): log.debug('connecting to %s', t) - log.info('Key is :%s:', xkey) - oldkeystatus = lockstatus.get_status(ctx, t) - key = xkey - if 'sshpubkey' in oldkeystatus: - log.info('possible key is :%s:',oldkeystatus['sshpubkey']) - key = oldkeystatus['sshpubkey'] + try: + if ctx.config['sshkeys'] == 'ignore': + key = None + except (AttributeError, KeyError): + pass + for machine in ctx.config['targets'].iterkeys(): + if teuthology.is_vm(machine): + key = None + break remotes.append( remote.Remote(name=t, ssh=connection.connect(user_at_host=t, -- 2.39.5