]> Frank Brehm's Git Trees - pixelpark/pp-admin-tools.git/commitdiff
Checking earlier for root.
authorFrank Brehm <frank@brehm-online.com>
Mon, 29 Nov 2021 13:26:31 +0000 (14:26 +0100)
committerFrank Brehm <frank@brehm-online.com>
Mon, 29 Nov 2021 13:26:31 +0000 (14:26 +0100)
lib/pp_admintools/deploy_zones_from_pdns.py

index a3eeead228df5b3c31a8cb12742aacd77e2e0bf5..17401b09cb63b2ede1a00a13b3acd53e4a89a461 100644 (file)
@@ -332,6 +332,16 @@ class PpDeployZonesApp(PpPDNSApplication):
 
         """
 
+        my_uid = os.geteuid()
+        if my_uid:
+            msg = _("You must be root to execute this script.")
+            if self.simulate:
+                LOG.warn(msg)
+                time.sleep(1)
+            else:
+                LOG.error(msg)
+                self.exit(1)
+
         super(PpDeployZonesApp, self).pre_run()
 
         if self.environment == 'global':
@@ -352,16 +362,6 @@ class PpDeployZonesApp(PpPDNSApplication):
             LOG.error(_("Unknown time zone: {!r}.").format(local_tz_name))
             self.exit(6)
 
-        my_uid = os.geteuid()
-        if my_uid:
-            msg = _("You must be root to execute this script.")
-            if self.simulate:
-                LOG.warn(msg)
-                time.sleep(1)
-            else:
-                LOG.error(msg)
-                self.exit(1)
-
         try:
             self.pidfile.create()
         except PidFileError as e: