From 231736c20635a7125808b7a071c83dbbcab9d9f5 Mon Sep 17 00:00:00 2001 From: Kyr Shatskyy Date: Fri, 2 Aug 2024 19:38:41 +0200 Subject: [PATCH] misc: use tunnel when collecting keys from host If there is tunneling present in teuthology config for a host, then use it while trying to collect ssh public keys for it. Signed-off-by: Kyr Shatskyy --- teuthology/misc.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/teuthology/misc.py b/teuthology/misc.py index 97521895a..ef8ccb281 100644 --- a/teuthology/misc.py +++ b/teuthology/misc.py @@ -1112,6 +1112,11 @@ def _ssh_keyscan(hostname): :returns: The host key """ args = ['ssh-keyscan', '-T', '1', hostname] + if config.tunnel: + for tunnel in config.tunnel: + if hostname in tunnel.get('hosts'): + bastion = tunnel.get('bastion') + args = ['ssh', bastion.get('host')] + args p = subprocess.Popen( args=args, stdout=subprocess.PIPE,