]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
xxx: try to use test user name from config
authorJohn Mulligan <phlogistonjohn@asynchrono.us>
Fri, 9 Aug 2024 19:14:59 +0000 (15:14 -0400)
committerJohn Mulligan <phlogistonjohn@asynchrono.us>
Fri, 9 Aug 2024 19:14:59 +0000 (15:14 -0400)
Signed-off-by: John Mulligan <phlogistonjohn@asynchrono.us>
teuthology/misc.py
teuthology/task/ssh_keys.py

index 97521895ac655ba4189cec0d38c02bccd36dba9e..06cb14f2138135eeeafee210c1589e97388c91a3 100644 (file)
@@ -51,7 +51,8 @@ def host_shortname(hostname):
     else:
         return hostname.split('.', 1)[0]
 
-def canonicalize_hostname(hostname, user: Optional[str] ='ubuntu'):
+def canonicalize_hostname(hostname, user: Optional[str] = None):
+    user = user or get_test_user()
     hostname_expr = hostname_expr_templ.format(
         lab_domain=config.lab_domain.replace('.', r'\.'))
     match = re.match(hostname_expr, hostname)
index 0f497ebe9060de3429139a942baffe2c3894d1ab..a6d57c5f59267b23fb8e1896a1058aa943026c07 100644 (file)
@@ -93,21 +93,22 @@ def tweak_ssh_config(ctx, config):
     """
     Turn off StrictHostKeyChecking
     """
+    user = misc.get_test_user()
     run.wait(
         ctx.cluster.run(
             args=[
                 'echo',
                 'StrictHostKeyChecking no\n',
                 run.Raw('>'),
-                run.Raw('/home/ubuntu/.ssh/config'),
+                run.Raw(f'/home/{user}/.ssh/config'),
                 run.Raw('&&'),
                 'echo',
                 'UserKnownHostsFile ',
                 run.Raw('/dev/null'),
                 run.Raw('>>'),
-                run.Raw('/home/ubuntu/.ssh/config'),
+                run.Raw(f'/home/{user}/.ssh/config'),
                 run.Raw('&&'),
-                run.Raw('chmod 600 /home/ubuntu/.ssh/config'),
+                run.Raw(f'chmod 600 /home/{user}/.ssh/config'),
             ],
             wait=False,
         )
@@ -119,7 +120,7 @@ def tweak_ssh_config(ctx, config):
     finally:
         run.wait(
             ctx.cluster.run(
-                args=['rm',run.Raw('/home/ubuntu/.ssh/config')],
+                args=['rm',run.Raw(f'/home/{user}/.ssh/config')],
             wait=False
             ),
         )