dns: fix dns-update fqdn() double-appending zone to FQDN records #481
Reference in New Issue
Block a user
Delete Branch "benvin/dns-update-fqdn-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
6 hosts (ausyd1nxvm2069-2073, 2098) ended up with a reverse PTR in bind-authoritative but no forward A record, and the
unkin.netservice records (git/grafana/auth/fafflix, all published by the halb host 2069) never landed at all.VictoriaLogs (
dns-update-applyon 2069 & 2070) shows the cause:profiles::dns::recordpublishes some records whose name is already fully-qualified (trailing dot) — e.g.au-syd1-pve.main.unkin.net.,cobbler.main.unkin.net.,dashboard.ceph.unkin.net., and the halb CNAMEs. Thedns-updatescriptfqdn()unconditionally appended the zone, producing…net..main.unkin.net.— the..is an empty label, which nsupdate rejects, failing the entire per-zonesend. The reverse-PTR send is sorted first and its name is always relative, so it still applied — hence "PTR but no A".Change
fqdn()now handles three cases:@/empty → zone apex (unchanged).→ already FQDN, used verbatim (the fix).zone.(unchanged)Verified against all record shapes (relative host, apex, FQDN CNAME, reverse label) — no more
...After merge
Once puppet re-runs on the affected hosts their
main.unkin.net/unkin.netupdates succeed, filling in the missing A records and theunkin.netservice zone. Pairs with argocd-apps#260 (adds theceph.unkin.netzone sodashboard.ceph.unkin.netdoes not then hit NOTZONE).profiles::dns::record publishes some records with an already-qualified name (trailing dot), e.g. au-syd1-pve.main.unkin.net., cobbler.main.unkin.net., dashboard.ceph.unkin.net., and the halb service CNAMEs. The dns-update script's fqdn() unconditionally appended the zone, producing a '..' empty label; nsupdate rejects the whole per-zone update with 'invalid owner name: empty label' + 'syntax error'. The reverse-PTR send (sorted first, always relative) still applied, so affected hosts ended up with a PTR but no A. Handle the already-FQDN case (name ends in '.') by using it verbatim; keep the apex ('@'/empty) and relative cases as before. Fixes hosts stuck with PTR-but-no-A (e.g. ausyd1nxvm2069-2073, 2098) and repopulates the unkin.net service records (git/grafana/auth/fafflix).