Remove superfluous except: and change Exception returned if dnspython is not

available.
This commit is contained in:
Wilfried Teiken 2016-01-06 22:56:59 -05:00
parent 266dc9535a
commit 02a493011e
2 changed files with 2 additions and 5 deletions

View file

@ -246,8 +246,8 @@ class DNS01Response(KeyAuthorizationChallengeResponse):
txt_records = dns_resolver.txt_records_for_name(
validation_domain_name)
except ImportError: # pragma: no cover
raise ImportError("Local validation for 'dns-01' challenges "
"requires 'dnspython'")
raise errors.Error("Local validation for 'dns-01' challenges "
"requires 'dnspython'")
exists = validation in txt_records
if not exists:
logger.debug("Key authorization from response (%r) doesn't match "

View file

@ -19,9 +19,6 @@ def txt_records_for_name(name):
"""
try:
dns_response = dns.resolver.query(name, 'TXT')
except ImportError as error: # pragma: no cover
raise ImportError("Local validation for 'dns-01' challenges requires "
"'dnspython'")
except dns.exception.DNSException as error:
logger.error("Unable to resolve %s: %s", name, str(error))
return []