node-lookup: auto-qualify short node names to .main.unkin.net #19

Merged
benvin merged 1 commits from benvin/node-lookup-shortname into main 2026-08-15 14:50:36 +10:00

1 Commits

Author SHA1 Message Date
unkin-agent 807d3df71c node-lookup: auto-qualify short node names to .main.unkin.net
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
Short -n node names (no dot) now silently returned nothing because the
PuppetDB certname filter needs a FQDN. Auto-qualify a dotless name to
<name>.<domain> (domain defaults to main.unkin.net) before the query.

- Add qualifyNode() pure helper: dotless names get .<domain> appended;
  names already containing a dot (any domain) are left unchanged; a single
  trailing dot is stripped; empty input is preserved.
- Apply it to the -n value and to stdin-sourced node names in run().
- Make the domain configurable via config key domain, NODE_LOOKUP_DOMAIN
  env var, and --domain flag (default main.unkin.net).
- Surface domain in config show / config init and document in AGENTS.md.
- Add table-driven qualifyNode tests and a domain env-override test.
2026-08-15 13:49:01 +10:00