Skip to content

Commit

Permalink
misc._ssh_keyscan: Sort keys before returning any
Browse files Browse the repository at this point in the history
ssh-keyscan's output is unsorted, so this function wasn't deterministic.

Signed-off-by: Zack Cerza <zack@redhat.com>
  • Loading branch information
zmc committed Sep 5, 2023
1 parent f9a8556 commit dbd55e3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion teuthology/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1138,9 +1138,11 @@ def _ssh_keyscan(hostname):
line = line.strip()
if line and not line.startswith('#'):
log.error(line)
keys = list()
for line in p.stdout:
host, key = line.strip().decode().split(' ', 1)
return key
keys.append(key)
return sorted(keys)[0]


def ssh_keyscan_wait(hostname):
Expand Down

0 comments on commit dbd55e3

Please sign in to comment.