Don't crash if a custom DNS entry is not under a zone managed by the box, fixes #1961

This commit is contained in:
Joshua Tauberer 2021-10-22 18:39:53 -04:00
parent 65861c68b7
commit 34017548d5

View file

@ -330,7 +330,7 @@ def dns_get_records(qname=None, rtype=None):
r["sort-order"]["created"] = i r["sort-order"]["created"] = i
domain_sort_order = utils.sort_domains([r["qname"] for r in records], env) domain_sort_order = utils.sort_domains([r["qname"] for r in records], env)
for i, r in enumerate(sorted(records, key = lambda r : ( for i, r in enumerate(sorted(records, key = lambda r : (
zones.index(r["zone"]), zones.index(r["zone"]) if r.get("zone") else 0, # record is not within a zone managed by the box
domain_sort_order.index(r["qname"]), domain_sort_order.index(r["qname"]),
r["rtype"]))): r["rtype"]))):
r["sort-order"]["qname"] = i r["sort-order"]["qname"] = i