Merge pull request #1597 from modoboa/fix/mx_query_no_result

A or AAAA record might not be available.
This commit is contained in:
Antoine Nguyen
2018-10-18 09:39:35 +02:00
committed by GitHub
3 changed files with 5 additions and 0 deletions
+2
View File
@@ -204,6 +204,8 @@ def get_domain_mx_list(domain):
logger.error(
_("No {type} record found for MX {mx}").format(
type=rtype, mx=domain), exc_info=e)
except dns.resolver.NoAnswer:
pass
else:
for ip_answer in ip_answers:
try:
+1
View File
@@ -129,6 +129,7 @@ class MXTestCase(ModoTestCase):
get_domain_mx_list("no-ns-servers.example.com")
get_domain_mx_list("timeout.example.com")
get_domain_mx_list("no-lookup.example.com")
get_domain_mx_list("no-answer.example.Com")
get_domain_mx_list("bad-response.example.com")
log.check(
("modoboa.admin", "ERROR",
+2
View File
@@ -45,12 +45,14 @@ _POSSIBLE_DNS_RESULTS = {
"no-ns-servers.example.com": NoNameservers(),
"bad-response.example.com": [_BAD_MX_RECORD],
"no-lookup.example.com": [_DNE_MX_RECORD],
"no-answer.example.com": [_DNE_MX_RECORD],
}
_POSSIBLE_DNS_RESULTS_NO_MX = {
"does-not-exist.example.com": NXDOMAIN(),
"mx2.example.com": NXDOMAIN(),
"no-lookup.example.com": NXDOMAIN(),
"no-answer.example.com": NoAnswer(),
"bad-response.example.com": [RRsetInvalid()],
}
_POSSIBLE_IP_RESULTS = {