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:
# 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: