From: Frank Brehm Date: Fri, 18 Nov 2022 10:32:34 +0000 (+0100) Subject: Checking given timeout X-Git-Tag: 0.7.2^2^2~2 X-Git-Url: https://git.uhu-banane.net/?a=commitdiff_plain;h=db59d0e4f606a856f4e8264bdd67efc7df752640;p=pixelpark%2Fpp-admin-tools.git Checking given timeout --- diff --git a/lib/pp_admintools/app/pdns.py b/lib/pp_admintools/app/pdns.py index f588fde..06429ae 100644 --- a/lib/pp_admintools/app/pdns.py +++ b/lib/pp_admintools/app/pdns.py @@ -43,7 +43,7 @@ from ..config.pdns import PdnsConfiguration from ..xlate import XLATOR -__version__ = '0.9.9' +__version__ = '0.9.10' LOG = logging.getLogger(__name__) _ = XLATOR.gettext @@ -279,7 +279,7 @@ class PpPDNSApplication(BaseMailApplication): PdnsConfiguration.default_pdns_api_port), ) - help_msg=_( + help_msg = _( "The timeout in seconds for the communication with the PowerDNS-API. " "Default: {} seconds.").format(PdnsConfiguration.default_pdns_timeout) pdns_group.add_argument( @@ -375,6 +375,13 @@ class PpPDNSApplication(BaseMailApplication): self.api_port = self.args.api_port if self.args.timeout: + if self.args.timeout > MAX_TIMEOUT: + msg = _("Timeout of {t} seconds too big, at most {m} seconds are allowed.") + msg = msg.format(t=self.args.timeout, m=MAX_TIMEOUT) + self.exit(1, msg) + if self.args.timeout < 0: + msg = _("A tomeout may not be negative.") + self.exit(1, msg) self.cfg.pdns_timeout = self.args.timeout self.pdns = PowerDNSServer(