dns_zone: ensure zone files are sorted

dns
jeltz 2 years ago
parent b9dd74af40
commit 9f8dcecf63
Signed by: jeltz
GPG Key ID: 800882B66C0C3326

@ -293,7 +293,9 @@ def make_records(args, ty):
def zones_eq(lhs: dns.zone.Zone, rhs: dns.zone.Zone) -> bool:
"""Returns a `bool` indicating whether two `dns.zone.Zone`s are equal
w.r.t. their text representation."""
return lhs.to_text(relativize=False) == rhs.to_text(relativize=False)
return lhs.to_text(relativize=False, sorted=True) == rhs.to_text(
relativize=False, sorted=True
)
def main() -> int:
@ -365,7 +367,7 @@ def main() -> int:
changed = current is None or not zones_eq(zone, current)
if changed:
zone.to_file(module.params["path"], relativize=False)
zone.to_file(module.params["path"], relativize=True, sorted=True)
changed = module.set_fs_attributes_if_different(file_args, changed)

Loading…
Cancel
Save