Skip to content

Commit

Permalink
misc: use tunnel when collecting keys from host
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Kyr Shatskyy committed Aug 2, 2024
1 parent 1eced30 commit 5e4ea9f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions teuthology/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5e4ea9f

Please sign in to comment.