From: Zack Cerza Date: Wed, 27 Aug 2014 18:05:19 +0000 (-0600) Subject: Only pass lists to ssh_keyscan() X-Git-Tag: 1.1.0~1198 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8a87a422ca7000cc1a8eeb32f21da30f17487bda;p=teuthology.git Only pass lists to ssh_keyscan() Signed-off-by: Zack Cerza --- diff --git a/teuthology/lock.py b/teuthology/lock.py index dd01a9ef0..29a8b9b85 100644 --- a/teuthology/lock.py +++ b/teuthology/lock.py @@ -355,7 +355,7 @@ def update_lock(name, description=None, status=None, ssh_pub_key=None): ssh_key = None while not ssh_key: time.sleep(10) - ssh_key = ssh_keyscan(name) + ssh_key = ssh_keyscan([name]) updated = {} if description is not None: updated['description'] = description @@ -377,13 +377,11 @@ def ssh_keyscan(hostnames): """ Fetch the SSH public key of one or more hosts """ + if isinstance(hostnames, basestring): + raise TypeError("'hostnames' must be a list") hostnames = [misc.canonicalize_hostname(name, user=None) for name in hostnames] - args = ['ssh-keyscan', '-t', 'rsa'] - if isinstance(hostnames, basestring): - args.append(hostnames) - else: - args.extend(hostnames) + args = ['ssh-keyscan', '-t', 'rsa'] + hostnames p = subprocess.Popen( args=args, stdout=subprocess.PIPE,