From adc8a9c0a812c3dc8de118a698cc5b9ca3bc8500 Mon Sep 17 00:00:00 2001 From: Adam King Date: Tue, 27 Apr 2021 14:32:05 -0400 Subject: [PATCH] cephadm: re-assimilate user provided conf after mgr created Fixes: https://tracker.ceph.com/issues/50544 Signed-off-by: Adam King --- src/cephadm/cephadm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 15fbb4cf21e..b2b4bd7cb70 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3963,6 +3963,12 @@ def command_bootstrap(ctx): except PermissionError: raise Error(f'Unable to create {dirname} due to permissions failure. Retry with root, or sudo or preallocate the directory.') + if ctx.config and os.path.exists(ctx.config): + with open(ctx.config) as f: + user_conf = f.read() + else: + user_conf = None + if not ctx.skip_prepare_host: command_prepare_host(ctx) else: @@ -4057,6 +4063,19 @@ def command_bootstrap(ctx): # create mgr create_mgr(ctx, uid, gid, fsid, mgr_id, mgr_key, config, cli) + if user_conf: + # user given config settings were already assimilated earlier + # but if the given settings contained any attributes in + # the mgr (e.g. mgr/cephadm/container_image_prometheus) + # they don't seem to be stored if there isn't a mgr yet. + # Since re-assimilating the same conf settings should be + # idempotent we can just do it aain here. + with tempfile.NamedTemporaryFile(buffering=0) as tmp: + tmp.write(user_conf.encode('utf-8')) + cli(['config', 'assimilate-conf', + '-i', '/var/lib/ceph/user.conf'], + {tmp.name: '/var/lib/ceph/user.conf:z'}) + def json_loads_retry(cli_func): for sleep_secs in [1, 4, 4]: try: -- 2.39.5