From f0f0b4db0863ff10cf68e1d3d18668e6e1d64cf9 Mon Sep 17 00:00:00 2001 From: Adrien Ferrand Date: Wed, 19 Jan 2022 11:47:34 +0100 Subject: [PATCH] Final typing fixes --- certbot-apache/certbot_apache/_internal/configurator.py | 4 +++- certbot/certbot/plugins/common.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/certbot-apache/certbot_apache/_internal/configurator.py b/certbot-apache/certbot_apache/_internal/configurator.py index 67b89e788..8b09e0637 100644 --- a/certbot-apache/certbot_apache/_internal/configurator.py +++ b/certbot-apache/certbot_apache/_internal/configurator.py @@ -984,7 +984,9 @@ class ApacheConfigurator(common.Configurator): for arg in args: arg_value = self.parser.get_arg(arg) if arg_value is not None: - addrs.add(obj.Addr.fromstring(arg_value)) + addr = obj.Addr.fromstring(arg_value) + if addr is not None: + addrs.add(addr) is_ssl = False if self.parser.find_dir("SSLEngine", "on", start=path, exclude=False): diff --git a/certbot/certbot/plugins/common.py b/certbot/certbot/plugins/common.py index b8aa023d1..3af0ee6ec 100644 --- a/certbot/certbot/plugins/common.py +++ b/certbot/certbot/plugins/common.py @@ -261,7 +261,7 @@ class Addr: self.ipv6 = ipv6 @classmethod - def fromstring(cls: Type[GenericAddr], str_addr: str) -> GenericAddr: + def fromstring(cls: Type[GenericAddr], str_addr: str) -> Optional[GenericAddr]: """Initialize Addr from string.""" if str_addr.startswith('['): # ipv6 addresses starts with [