node-lookup: auto-qualify short node names to .main.unkin.net #19
Reference in New Issue
Block a user
Delete Branch "benvin/node-lookup-shortname"
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?
Short
-nnode names silently returned nothing:node-lookup -R -n ausyd1nxvm2120found nothing while-n ausyd1nxvm2120.main.unkin.networked, because the PuppetDBcertnamefilter needs a FQDN. This auto-qualifies a dotless name before the lookup.Changes
qualifyNode()pure helper: a dotless name gets.<domain>appended; a name already containing a dot (any domain, incl.*.k8s.syd1.au.unkin.net) is left unchanged; a single trailing dot is stripped first; empty input is preserved (same "no node" behavior as today).-nvalue and to stdin-sourced node names inrun(), so both entry points behave consistently.domain,NODE_LOOKUP_DOMAINenv var, and--domainflag, all defaulting tomain.unkin.net.domaininconfig show/config initoutput and document the new env var/flag/behavior in AGENTS.md.qualifyNodetests (short name appended, FQDN unchanged, multi-label other-domain FQDN unchanged, trailing-dot handling, empty input, custom domain) and aNODE_LOOKUP_DOMAINenv-override test.Companion tools
pburl/pblastreporttake already-qualified hostnames (typically piped fromnode-lookup) viapuppet.ReadHostsand do not share the-ncode path, so they are intentionally left out to keep this PR atomic.Validation
gofmt -l .clean,go vet ./...cleango test -race ./...passmake buildbuilds all three binaries