]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: verify the output files' containing directory exists
authorSage Weil <sage@redhat.com>
Sun, 15 Mar 2020 15:09:30 +0000 (10:09 -0500)
committerSage Weil <sage@redhat.com>
Sun, 15 Mar 2020 15:19:22 +0000 (10:19 -0500)
Signed-off-by: Sage Weil <sage@redhat.com>
src/cephadm/cephadm

index fa74cc81bfa3dcf30f7ce405fe6fbf0b4e76013e..4a8e7bcc1c9971bd6f4fe8f785df8ef2f00eb1e9 100755 (executable)
@@ -1974,11 +1974,14 @@ def command_bootstrap():
     # type: () -> int
 
     # verify output files
-    if not args.allow_overwrite:
-        for f in [args.output_config, args.output_keyring, args.output_pub_ssh_key]:
+    for f in [args.output_config, args.output_keyring, args.output_pub_ssh_key]:
+        if not args.allow_overwrite:
             if os.path.exists(f):
                 raise Error('%s already exists; delete or pass '
                               '--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))
 
     if not args.skip_prepare_host:
         command_prepare_host()