From: Kyr Shatskyy Date: Wed, 31 Jul 2024 21:48:09 +0000 (+0200) Subject: misc: allow _ssh_keyscan return None again X-Git-Tag: 1.2.0~3^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F1990%2Fhead;p=teuthology.git misc: allow _ssh_keyscan return None again A host may not have any keys, so _ssh_keyscan should return None, instead of failing with error: IndexError: list index out of range Fixes: dbd55e37563ce0fde01e1bfa19ca2fd2c03f0194 Signed-off-by: Kyr Shatskyy --- diff --git a/teuthology/misc.py b/teuthology/misc.py index c3d324a4b..97521895a 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -1127,7 +1127,8 @@ def _ssh_keyscan(hostname): for line in p.stdout: host, key = line.strip().decode().split(' ', 1) keys.append(key) - return sorted(keys)[0] + if len(keys) > 0: + return sorted(keys)[0] def ssh_keyscan_wait(hostname):