whats_next: Allow the PRIMARY_HOSTNAME to not have an MX because the default value means the domain itself, which is what we want anyway

This commit is contained in:
Joshua Tauberer 2014-07-07 02:17:04 +00:00
parent e898cd5d2a
commit 28e254fb84
1 changed files with 7 additions and 2 deletions

View File

@ -158,12 +158,17 @@ def check_dns_zone(domain, env, dns_zonefiles):
print("")
def check_mail_domain(domain, env):
# Check the MX record.
mx = query_dns(domain, "MX")
# Check the MX record. A missing MX record is okay on the primary hostname
# because the primary hostname's A record (the MX fallback) is... itself,
# which s what we want the MX to be.
mx = query_dns(domain, "MX", nxdomain=None)
expected_mx = "10 " + env['PRIMARY_HOSTNAME']
if mx == expected_mx:
print_ok("Domain's email is directed to this domain. [%s => %s]" % (domain, mx))
elif mx == None and domain == env['PRIMARY_HOSTNAME']:
print_ok("Domain's email is directed to this domain. [%s has no MX record, which is ok]" % (domain,))
else:
if mx == None: mx = "[Not Set]"
print_error("""This domain's DNS MX record is incorrect. It is currently set to '%s' but should be '%s'. Mail will not
be delivered to this box. It may take several hours for public DNS to update after a change. This problem may result from
other issues listed here.""" % (mx, expected_mx))