From a1f03af159d6c1f2c06d53b91976331913f5e2d2 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Mon, 29 Nov 2021 14:26:31 +0100 Subject: [PATCH] Checking earlier for root. --- lib/pp_admintools/deploy_zones_from_pdns.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/pp_admintools/deploy_zones_from_pdns.py b/lib/pp_admintools/deploy_zones_from_pdns.py index a3eeead..17401b0 100644 --- a/lib/pp_admintools/deploy_zones_from_pdns.py +++ b/lib/pp_admintools/deploy_zones_from_pdns.py @@ -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: -- 2.39.5