From: Zack Cerza Date: Tue, 5 Sep 2023 18:42:46 +0000 (-0600) Subject: misc._ssh_keyscan: Sort keys before returning any X-Git-Tag: 1.2.0~72^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=dbd55e37563ce0fde01e1bfa19ca2fd2c03f0194;p=teuthology.git misc._ssh_keyscan: Sort keys before returning any ssh-keyscan's output is unsorted, so this function wasn't deterministic. Signed-off-by: Zack Cerza --- diff --git a/teuthology/misc.py b/teuthology/misc.py index 76a21815d..c03be7e85 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -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):