]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: raise an error when `--config` file is not found
authorMichael Fritch <mfritch@suse.com>
Thu, 13 May 2021 23:03:10 +0000 (17:03 -0600)
committerSage Weil <sage@newdream.net>
Thu, 3 Jun 2021 12:41:50 +0000 (07:41 -0500)
extend the common logic used by the deploy, ceph-volume, and shell
commands for validating the `--config` arg during bootstrap

Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit 0e444191b93b76527eccb349bd0f68b1fc9302d4)

src/cephadm/cephadm

index f5973a33ea9255fe545a6a8a26547acd50514fdd..1b0fe9b069a253479f8c789b4d929baa8e4d1e75 100755 (executable)
@@ -3983,11 +3983,7 @@ 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
+    (user_conf, _) = get_config_and_keyring(ctx)
 
     if not ctx.skip_prepare_host:
         command_prepare_host(ctx)
@@ -4089,7 +4085,7 @@ def command_bootstrap(ctx):
         # 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.
+        # idempotent we can just do it again here.
         with tempfile.NamedTemporaryFile(buffering=0) as tmp:
             tmp.write(user_conf.encode('utf-8'))
             cli(['config', 'assimilate-conf',