From: Michael Fritch Date: Thu, 13 May 2021 23:03:10 +0000 (-0600) Subject: cephadm: raise an error when `--config` file is not found X-Git-Tag: v16.2.5~87^2~22 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=867ffc6afabc73a7591f692f46038f8512038cb6;p=ceph.git cephadm: raise an error when `--config` file is not found 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 (cherry picked from commit 0e444191b93b76527eccb349bd0f68b1fc9302d4) --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index f5973a33ea92..1b0fe9b069a2 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -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',