From: Adam King Date: Tue, 27 Apr 2021 18:32:05 +0000 (-0400) Subject: cephadm: re-assimilate user provided conf after mgr created X-Git-Tag: v16.2.5~39^2~4^2^2~19 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e630af9c9b2f93c9ae3bed5a1378860470fcbd0d;p=ceph.git cephadm: re-assimilate user provided conf after mgr created Fixes: https://tracker.ceph.com/issues/50544 Signed-off-by: Adam King (cherry picked from commit adc8a9c0a812c3dc8de118a698cc5b9ca3bc8500) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index f55cc8f81ef..093019aebf6 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: