Skip to content

Commit

Permalink
misc: allow _ssh_keyscan return None again
Browse files Browse the repository at this point in the history
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: dbd55e3

Signed-off-by: Kyr Shatskyy <[email protected]>
  • Loading branch information
Kyr Shatskyy committed Aug 7, 2024
1 parent e3a44bb commit 837a0e1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion teuthology/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 837a0e1

Please sign in to comment.