From 18832a3e94f55d0abb3c22290a7dc4dce9156944 Mon Sep 17 00:00:00 2001 From: John Mulligan Date: Thu, 19 Oct 2023 14:12:40 -0400 Subject: [PATCH] cephadm: split get_deployment_container function Split get_deployment_container into to_depoyment_container and a call to get_container. A future change will remove get_deployment_container entirely. Signed-off-by: John Mulligan --- src/cephadm/cephadm.py | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/cephadm/cephadm.py b/src/cephadm/cephadm.py index 4ea82676573..23420c2b473 100755 --- a/src/cephadm/cephadm.py +++ b/src/cephadm/cephadm.py @@ -5106,25 +5106,37 @@ def get_deployment_container( # wrapper for get_container specifically for containers made during the `cephadm deploy` # command. Adds some extra things such as extra container args and custom config files c = get_container(ctx, ident, privileged, ptrace, container_args) + return to_deployment_container(ctx, c) + + +def to_deployment_container( + ctx: CephadmContext, ctr: CephContainer +) -> CephContainer: + """Given a standard ceph container instance return a CephContainer + prepared for a deployment as a daemon, having the extra args and + custom configurations added. + NOTE: The `ctr` object is mutated before being returned. + """ if 'extra_container_args' in ctx and ctx.extra_container_args: - c.container_args.extend(ctx.extra_container_args) + ctr.container_args.extend(ctx.extra_container_args) if 'extra_entrypoint_args' in ctx and ctx.extra_entrypoint_args: - c.args.extend(ctx.extra_entrypoint_args) + ctr.args.extend(ctx.extra_entrypoint_args) ccfiles = fetch_custom_config_files(ctx) if ccfiles: mandatory_keys = ['mount_path', 'content'] for conf in ccfiles: if all(k in conf for k in mandatory_keys): mount_path = conf['mount_path'] + assert ctr.identity file_path = os.path.join( ctx.data_dir, - ident.fsid, + ctr.identity.fsid, 'custom_config_files', - ident.daemon_name, + ctr.identity.daemon_name, os.path.basename(mount_path) ) - c.volume_mounts[file_path] = mount_path - return c + ctr.volume_mounts[file_path] = mount_path + return ctr def get_deployment_type( -- 2.39.5