]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
qa/tasks: embed use of ssh_keys task in smb workunit
authorJohn Mulligan <jmulligan@redhat.com>
Wed, 7 Jan 2026 23:02:21 +0000 (18:02 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Fri, 16 Jan 2026 14:41:27 +0000 (09:41 -0500)
Automatically use the ssh_keys tasks in the smb workunit task.
It can be disabled by passing false to `ssh_keys:` config key.
This allows the node running the tests to ssh into the node where
cephadm is installed in order to execute commands within
the cephadm shell.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
qa/tasks/smb.py

index adc64d05ec1992de73ef044ee5b9c1091e61f760..d456234e695afdf345a71b6e13a6e1de6cc33bd5 100644 (file)
@@ -10,6 +10,7 @@ import shlex
 import time
 
 from teuthology.exceptions import ConfigError, CommandFailedError
+from teuthology.task import ssh_keys
 
 
 log = logging.getLogger(__name__)
@@ -350,16 +351,16 @@ def workunit(ctx, config):
     from . import workunit
 
     _config = copy.deepcopy(config)
-    clients = _config.get('clients') or {}
-    env = _config.get('env') or {}
+    clients = _config.get("clients") or {}
+    env = _config.get("env") or {}
 
     clients = {k: _workunit_commands(k, v) for k, v in clients.items()}
-    mfile = _config.get('metadata_file_path', _DEFAULT_META_FILE)
-    env['SMB'] = 'yes'
-    env['SMB_TEST_META'] = mfile
+    mfile = _config.get("metadata_file_path", _DEFAULT_META_FILE)
+    env["SMB"] = "yes"
+    env["SMB_TEST_META"] = mfile
 
-    _config['clients'] = clients
-    _config['env'] = env
+    _config["clients"] = clients
+    _config["env"] = env
     # annoyingly the stock workunit helper script command uses a tool (from the
     # ceph/teuthology repo) called adjust-ulimits *and* a tool (from packages)
     # called ceph-coverage. They're glued together under the
@@ -369,11 +370,16 @@ def workunit(ctx, config):
     # teuthology tasks that installs adjust-ulimits. Just skip the whole thing
     # for now and we can set ulimits via pytest if we really want to set
     # ulimits. Allow the yaml to override our default, however unlikely.
-    _config['no_coverage_and_limits'] = config.get(
-        'no_coverage_and_limits', True
+    _config["no_coverage_and_limits"] = config.get(
+        "no_coverage_and_limits", True
     )
-    log.info('Passing workunit config: %r', _config)
-    with write_metadata_file(ctx, _config):
+    _ssh_keys_config = config.get("ssh_keys", {})
+    _config["enable_ssh_keys"] = _ssh_keys_config not in (False, None)
+    log.info("Passing workunit config: %r", _config)
+    with contextlib.ExitStack() as estack:
+        if _config["enable_ssh_keys"]:
+            estack.enter_context(ssh_keys.task(ctx, _ssh_keys_config))
+        estack.enter_context(write_metadata_file(ctx, _config))
         return workunit.task(ctx, _config)