Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orchestra/connection: ssh configuration options #1921

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion teuthology/orchestra/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,16 @@ def connect(user_at_host, host_key=None, keep_alive=False, timeout=60,
)

key_filename = key_filename or config.ssh_key
ssh_config_path = os.path.expanduser("~/.ssh/config")
ssh_config_path = config.ssh_config_path or "~/.ssh/config"
ssh_config_path = os.path.expanduser(ssh_config_path)
if not key_filename and os.path.exists(ssh_config_path):
ssh_config = paramiko.SSHConfig()
ssh_config.parse(open(ssh_config_path))
opts = ssh_config.lookup(host)
if not key_filename and 'identityfile' in opts:
key_filename = opts['identityfile']
if 'hostname' in opts:
connect_args['hostname'] = opts['hostname']

if key_filename:
if not isinstance(key_filename, list):
Expand Down