mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2024-11-23 02:27:05 +00:00
simplify dns exception catching
This commit is contained in:
parent
c462008a5e
commit
8d8d6e158b
@ -1036,15 +1036,11 @@ def set_secondary_dns(hostnames, env):
|
|||||||
# Resolve hostname.
|
# Resolve hostname.
|
||||||
try:
|
try:
|
||||||
response = resolver.resolve(item, "A")
|
response = resolver.resolve(item, "A")
|
||||||
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, dns.resolver.Timeout):
|
||||||
try:
|
try:
|
||||||
response = resolver.resolve(item, "AAAA")
|
response = resolver.resolve(item, "AAAA")
|
||||||
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer):
|
except (dns.resolver.NoNameservers, dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, dns.resolver.Timeout):
|
||||||
raise ValueError("Could not resolve the IP address of %s due to dns error." % item)
|
raise ValueError("Could not resolve the IP address of %s." % item)
|
||||||
except (dns.resolver.Timeout):
|
|
||||||
raise ValueError("Could not resolve the IP address of %s due to timeout." % item)
|
|
||||||
except (dns.resolver.Timeout):
|
|
||||||
raise ValueError("Could not resolve the IP address of %s due to timeout." % item)
|
|
||||||
else:
|
else:
|
||||||
# Validate IP address.
|
# Validate IP address.
|
||||||
try:
|
try:
|
||||||
|
Loading…
Reference in New Issue
Block a user