From: John Mulligan Date: Fri, 15 Mar 2024 17:48:35 +0000 (-0400) Subject: qa/tasks: add a cephadm samba container helper func independent of AD DC X-Git-Tag: v20.0.0~2300^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=b2197e43b5eeb326b2e5498a06a2e13f4a532b87;p=ceph.git qa/tasks: add a cephadm samba container helper func independent of AD DC To have the standalone (non-AD) server test function similarly to the AD member server test we need to set a variable for samba client container command similar to how the AD setup command does it. Signed-off-by: John Mulligan --- diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index 66d51aff2f548..008d8c94d55bb 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -1962,6 +1962,44 @@ def _samba_ad_dc_conf(ctx, remote, cengine): ] +@contextlib.contextmanager +def configure_samba_client_container(ctx, config): + # TODO: deduplicate logic between this task and deploy_samba_ad_dc + role = config.get('role') + samba_client_image = config.get( + 'samba_client_image', 'quay.io/samba.org/samba-client:latest' + ) + if not role: + raise ConfigError( + "you must specify a role to discover container engine / pull image" + ) + (remote,) = ctx.cluster.only(role).remotes.keys() + cengine = 'podman' + try: + log.info("Testing if podman is available") + remote.run(args=['sudo', cengine, '--help']) + except CommandFailedError: + log.info("Failed to find podman. Using docker") + cengine = 'docker' + + remote.run(args=['sudo', cengine, 'pull', samba_client_image]) + samba_client_container_cmd = [ + 'sudo', + cengine, + 'run', + '--rm', + '--net=host', + '-eKRB5_CONFIG=/dev/null', + samba_client_image, + ] + + setattr(ctx, 'samba_client_container_cmd', samba_client_container_cmd) + try: + yield + finally: + setattr(ctx, 'samba_client_container_cmd', None) + + @contextlib.contextmanager def deploy_samba_ad_dc(ctx, config): role = config.get('role')