]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: re-assimilate user provided conf after mgr created
authorAdam King <adking@redhat.com>
Tue, 27 Apr 2021 18:32:05 +0000 (14:32 -0400)
committerAdam King <adking@redhat.com>
Tue, 27 Apr 2021 18:54:04 +0000 (14:54 -0400)
Fixes: https://tracker.ceph.com/issues/50544
Signed-off-by: Adam King <adking@redhat.com>
src/cephadm/cephadm

index 15fbb4cf21eeaef99f5d28198c87eb77187a7bd2..b2b4bd7cb705fff3a68c9d2d566543e6ef021d12 100755 (executable)
@@ -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: