From: Frank Brehm Date: Mon, 29 Nov 2021 13:26:31 +0000 (+0100) Subject: Checking earlier for root. X-Git-Tag: 0.4.1~5^2~18^2~4 X-Git-Url: https://git.uhu-banane.org/?a=commitdiff_plain;h=a1f03af159d6c1f2c06d53b91976331913f5e2d2;p=pixelpark%2Fpp-admin-tools.git Checking earlier for root. --- 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: