mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 20:12:42 +02:00
types: CredentialsConfiguration.conf can return None
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import logging
|
||||
from typing import Any
|
||||
from typing import Callable
|
||||
from typing import cast
|
||||
from typing import Optional
|
||||
|
||||
import dns.flags
|
||||
@@ -59,7 +60,7 @@ class Authenticator(dns_common.DNSAuthenticator):
|
||||
'RFC 2136 Dynamic Updates.'
|
||||
|
||||
def _validate_credentials(self, credentials: CredentialsConfiguration) -> None:
|
||||
server = credentials.conf('server')
|
||||
server = cast(str, credentials.conf('server'))
|
||||
if not is_ipaddress(server):
|
||||
raise errors.PluginError("The configured target DNS server ({0}) is not a valid IPv4 "
|
||||
"or IPv6 address. A hostname is not allowed.".format(server))
|
||||
@@ -89,11 +90,11 @@ class Authenticator(dns_common.DNSAuthenticator):
|
||||
def _get_rfc2136_client(self) -> "_RFC2136Client":
|
||||
if not self.credentials: # pragma: no cover
|
||||
raise errors.Error("Plugin has not been prepared.")
|
||||
return _RFC2136Client(self.credentials.conf('server'),
|
||||
int(self.credentials.conf('port') or self.PORT),
|
||||
self.credentials.conf('name'),
|
||||
self.credentials.conf('secret'),
|
||||
self.ALGORITHMS.get(self.credentials.conf('algorithm'),
|
||||
return _RFC2136Client(cast(str, self.credentials.conf('server')),
|
||||
int(cast(str, self.credentials.conf('port')) or self.PORT),
|
||||
cast(str, self.credentials.conf('name')),
|
||||
cast(str, self.credentials.conf('secret')),
|
||||
self.ALGORITHMS.get(self.credentials.conf('algorithm') or '',
|
||||
dns.tsig.HMAC_MD5))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user