]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: verify root privileges before log dir create 38011/head
authorMichael Fritch <mfritch@suse.com>
Tue, 10 Nov 2020 01:07:15 +0000 (18:07 -0700)
committerMichael Fritch <mfritch@suse.com>
Wed, 11 Nov 2020 16:24:40 +0000 (09:24 -0700)
root privileges need to be verified before creating the log dir

introduced by 81a7df0

Fixes: https://tracker.ceph.com/issues/48166
Signed-off-by: Michael Fritch <mfritch@suse.com>
src/cephadm/cephadm

index 783a7b12db34f174842f39960ed6808f40b77ba5..c2138b33c5b41399f6efd37072af4da983384dee 100755 (executable)
@@ -6013,6 +6013,11 @@ def _parse_args(av):
 
 if __name__ == "__main__":
 
+    # root?
+    if os.geteuid() != 0:
+        sys.stderr.write('ERROR: cephadm should be run as root\n')
+        sys.exit(1)
+
     # Logger configuration
     if not os.path.exists(LOG_DIR):
         os.makedirs(LOG_DIR)
@@ -6033,11 +6038,6 @@ if __name__ == "__main__":
           if handler.name == "console":
                handler.setLevel(logging.DEBUG)
 
-    # root?
-    if os.geteuid() != 0:
-        sys.stderr.write('ERROR: cephadm should be run as root\n')
-        sys.exit(1)
-
     if 'func' not in args:
         sys.stderr.write('No command specified; pass -h or --help for usage\n')
         sys.exit(1)