From: Paul Cuzner Date: Sun, 13 Dec 2020 22:15:38 +0000 (+1300) Subject: cephadm: create default output dir during bootstrap X-Git-Tag: v16.1.0~265^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=27b5eada81189ad01b31ff34bf0e362353cfbd92;p=ceph.git cephadm: create default output dir during bootstrap If the output dir doesn't exist the old behaviour was to abort bootstrap. Since we're running with UID=0, this patch will create the missing dirs for the user to keep the bootstrap process going Signed-off-by: Paul Cuzner --- diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 2b18283dfefe..24100f3dfdb1 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -2844,7 +2844,14 @@ def command_bootstrap(): '--allow-overwrite to overwrite' % f) dirname = os.path.dirname(f) if dirname and not os.path.exists(dirname): - raise Error('%s directory %s does not exist' % (f, dirname)) + fname = os.path.basename(f) + logger.info(f"Creating directory {dirname} for {fname}") + try: + # use makedirs to create intermediate missing dirs + os.makedirs(dirname, 0o700) + except PermissionError: + raise Error(f"Unable to create {dirname} due to permissions failure. Retry with root, or sudo or preallocate the directory.") + if not args.skip_prepare_host: command_prepare_host()