Skip to content

Commit b2197e4

Browse files
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 <[email protected]>
1 parent 1f3001e commit b2197e4

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

qa/tasks/cephadm.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,44 @@ def _samba_ad_dc_conf(ctx, remote, cengine):
19621962
]
19631963

19641964

1965+
@contextlib.contextmanager
1966+
def configure_samba_client_container(ctx, config):
1967+
# TODO: deduplicate logic between this task and deploy_samba_ad_dc
1968+
role = config.get('role')
1969+
samba_client_image = config.get(
1970+
'samba_client_image', 'quay.io/samba.org/samba-client:latest'
1971+
)
1972+
if not role:
1973+
raise ConfigError(
1974+
"you must specify a role to discover container engine / pull image"
1975+
)
1976+
(remote,) = ctx.cluster.only(role).remotes.keys()
1977+
cengine = 'podman'
1978+
try:
1979+
log.info("Testing if podman is available")
1980+
remote.run(args=['sudo', cengine, '--help'])
1981+
except CommandFailedError:
1982+
log.info("Failed to find podman. Using docker")
1983+
cengine = 'docker'
1984+
1985+
remote.run(args=['sudo', cengine, 'pull', samba_client_image])
1986+
samba_client_container_cmd = [
1987+
'sudo',
1988+
cengine,
1989+
'run',
1990+
'--rm',
1991+
'--net=host',
1992+
'-eKRB5_CONFIG=/dev/null',
1993+
samba_client_image,
1994+
]
1995+
1996+
setattr(ctx, 'samba_client_container_cmd', samba_client_container_cmd)
1997+
try:
1998+
yield
1999+
finally:
2000+
setattr(ctx, 'samba_client_container_cmd', None)
2001+
2002+
19652003
@contextlib.contextmanager
19662004
def deploy_samba_ad_dc(ctx, config):
19672005
role = config.get('role')

0 commit comments

Comments
 (0)