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: v17.1.0~1831^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0e444191b93b76527eccb349bd0f68b1fc9302d4;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 --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 92d2399f8825..df1b04f64537 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -3966,11 +3966,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) @@ -4072,7 +4068,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',