From dd15bf4384ab84970e59007999cd23461f251450 Mon Sep 17 00:00:00 2001 From: Joshua Tauberer Date: Tue, 17 Jun 2014 23:34:06 +0000 Subject: [PATCH] use a better sort order for records in DNS zone files --- management/dns_update.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/management/dns_update.py b/management/dns_update.py index 4cef749..bd029e9 100755 --- a/management/dns_update.py +++ b/management/dns_update.py @@ -165,7 +165,7 @@ def build_zone(domain, zonefile, env, with_ns=True): records.append(("_dmarc", "TXT", '"v=DMARC1; p=quarantine"')) # Sort the records. The None records *must* go first. Otherwise it doesn't matter. - records.sort(key = lambda rec : (rec[0] is not None, str(rec[0]))) + records.sort(key = lambda rec : list(reversed(rec[0].split(".")) if rec[0] is not None else "")) return records