import time
from teuthology.exceptions import ConfigError, CommandFailedError
+from teuthology.task import ssh_keys
log = logging.getLogger(__name__)
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
# 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)