]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
orchestra: Respect username if set in ssh config 2000/head
authorZack Cerza <zack@redhat.com>
Tue, 20 Aug 2024 22:24:33 +0000 (16:24 -0600)
committerZack Cerza <zack@redhat.com>
Tue, 20 Aug 2024 22:24:33 +0000 (16:24 -0600)
Signed-off-by: Zack Cerza <zack@redhat.com>
teuthology/orchestra/connection.py

index 4e6b042bfb4f4b79718115a92625fd88ec367941..1772d37b503c1826067edad0b31b76ea8a494e75 100644 (file)
@@ -82,7 +82,7 @@ def connect(user_at_host, host_key=None, keep_alive=False, timeout=60,
     key_filename = key_filename or config.ssh_key
     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):
+    if os.path.exists(ssh_config_path):
         ssh_config = paramiko.SSHConfig()
         ssh_config.parse(open(ssh_config_path))
         opts = ssh_config.lookup(host)
@@ -90,6 +90,8 @@ def connect(user_at_host, host_key=None, keep_alive=False, timeout=60,
             key_filename = opts['identityfile']
         if 'hostname' in opts:
             connect_args['hostname'] = opts['hostname']
+        if 'user' in opts:
+            connect_args['username'] = opts['user']
 
     if key_filename:
         if not isinstance(key_filename, list):