Report the backend host as the pdbmux_source value #31

Merged
benvin merged 4 commits from benvin/pdbmux-source-fact-fqdn into main 2026-10-10 01:08:15 +11:00
Member

The source fact carries the backend's configured name (new/old), which means nothing outside pdbmux's own config. The upstream PuppetDB host identifies where a node's data came from directly.

  • set pdbmux_source on /facts and /nodes to the lowercased backend URL hostname
  • match /facts/pdbmux_source/<value> and AST value filters against that hostname
  • reject host-less URLs and shared hostnames while the source fact is enabled
  • update README and tests
The source fact carries the backend's configured name (`new`/`old`), which means nothing outside pdbmux's own config. The upstream PuppetDB host identifies where a node's data came from directly. - set `pdbmux_source` on /facts and /nodes to the lowercased backend URL hostname - match `/facts/pdbmux_source/<value>` and AST value filters against that hostname - reject host-less URLs and shared hostnames while the source fact is enabled - update README and tests
Author
Member
  • config.go:321 — shared-host rejection runs even with source_fact_enabled: false, breaking previously valid configs (e.g. old/new PuppetDB on one host, different ports) for a collision that cannot occur → only enforce it when c.SourceFactEnabled, and add a Validate case for that.
  • nit: config.go:294 — url.Hostname() keeps case, so PuppetDB.example and puppetdb.example pass the duplicate check and the fact value depends on config spelling → strings.ToLower the host.
  • nit: source.go:41 — fallback emitting the backend name when unmapped is unreachable (s.hosts covers every backend) and would silently reintroduce name values → drop it and return si.hosts[backend].
- config.go:321 — shared-host rejection runs even with `source_fact_enabled: false`, breaking previously valid configs (e.g. old/new PuppetDB on one host, different ports) for a collision that cannot occur → only enforce it when `c.SourceFactEnabled`, and add a Validate case for that. - nit: config.go:294 — `url.Hostname()` keeps case, so `PuppetDB.example` and `puppetdb.example` pass the duplicate check and the fact value depends on config spelling → `strings.ToLower` the host. - nit: source.go:41 — fallback emitting the backend name when unmapped is unreachable (`s.hosts` covers every backend) and would silently reintroduce name values → drop it and return `si.hosts[backend]`.
Author
Member
  • e2e_main_test.go:82 — both e2e backends are http://127.0.0.1:<port> (e2e_backend_test.go:157) and the source fact is on by default, so the new shared-host check fails cfg.Validate() and the whole make e2e suite fatals before any test runs → reach the backends under distinct hosts (e.g. pdb-a.localhost/pdb-b.localhost, as the unit tests do)
  • e2e_query_test.go:772-775, e2e_query_test.go:289, e2e_health_test.go:80 — still expect pdbmux_source == backend name (pdb-a/pdb-b) → expect the backend host
  • source_test.go — conflicts with the base branch tip (97ddc37 "Narrow the source-fact /facts fetch…"); PR is unmergeable → merge the base branch in and resolve
- e2e_main_test.go:82 — both e2e backends are `http://127.0.0.1:<port>` (e2e_backend_test.go:157) and the source fact is on by default, so the new shared-host check fails `cfg.Validate()` and the whole `make e2e` suite fatals before any test runs → reach the backends under distinct hosts (e.g. `pdb-a.localhost`/`pdb-b.localhost`, as the unit tests do) - e2e_query_test.go:772-775, e2e_query_test.go:289, e2e_health_test.go:80 — still expect `pdbmux_source` == backend name (`pdb-a`/`pdb-b`) → expect the backend host - source_test.go — conflicts with the base branch tip (97ddc37 "Narrow the source-fact /facts fetch…"); PR is unmergeable → merge the base branch in and resolve
Author
Member

No findings.

No findings.
benvin changed target branch from benvin/pdbmux-source-fact-ast to main 2026-10-10 01:06:56 +11:00
benvin added 4 commits 2026-10-10 01:06:56 +11:00
Report the backend host as the source fact value
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
a43e5481f0
Check backend hosts only when the source fact is enabled, compare them case-insensitively
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
b1d68f5c80
# Conflicts:
#	source_test.go
Give e2e backends distinct hosts and assert the source fact host
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
3fe8c5b19f
benvin merged commit 9254396227 into main 2026-10-10 01:08:15 +11:00
benvin deleted branch benvin/pdbmux-source-fact-fqdn 2026-10-10 01:08:15 +11:00
Sign in to join this conversation.