Skip to content

refactor(deploy): consolidate per-daemon snmp-config.xml into shared overlay - #397

Merged
pbrane merged 1 commit into
developfrom
refactor/consolidate-shared-snmp-config
Jul 2, 2026
Merged

pbrane merged 1 commit into
developfrom
refactor/consolidate-shared-snmp-config

Conversation

@indigo423

@indigo423 indigo423 commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

What

Consolidate the SNMP peer configuration that was duplicated across all five SNMP-consuming daemon overlays (collectd, pollerd, provisiond, enlinkd, perspectivepollerd) into a single committed source of truth.

  • New: deploy/overlays/shared/etc/snmp-config.xml (the one committed copy).
  • Removed: the five per-daemon deploy/overlays/<daemon>/etc/snmp-config.xml copies; now git-ignored generated artifacts.
  • tools/build.sh: new stage_shared_snmp_config() fans the shared file into each consumer overlay at image-build time, wired into both the full-build (do_deltav_images) and single-daemon (do_single_daemon_image) paths — mirroring the existing stage_shared_poller_catalog() mechanism. build.sh is made sourceable (BASH_SOURCE guards around version resolution and main) so a test can exercise the real staging function.
  • New test: tools/stage-shared-snmp-config.test.sh — drift guard asserting the staged copies are byte-identical to the shared source (idempotency + fail-fast covered).

Why

Every community-string/definition change previously had to be applied five times by hand — a maintenance liability and a single-source-of-truth violation.

Behavior / compatibility

No runtime change: each daemon still loads its local etc/snmp-config.xml at boot via the unchanged snmpPeerFactory bean. Note: collectd and enlinkd previously lacked a trailing newline; the canonical source adopts the newline-terminated variant — a runtime-inert normalization (XML element is identical).

Verification

  • shellcheck clean; tools/stage-shared-snmp-config.test.sh → 8/8 pass.
  • Full make images (build.sh deltav): staging fired for all 5 consumers; all 5 daemon images built with the staged snmp-config.xml baked in at /opt/deltav/etc/snmp-config.xml, byte-identical to the shared source (md5 match).
  • make up PROFILE=full boot smoke: all 5 daemons load SnmpPeerFactory from /opt/deltav/etc/snmp-config.xml and start healthy.

Follow-up

Non-blocking hardening tracked in #396 (run the shell drift-guard tests in CI; add a build-time guard ensuring snmp-config.xml is staged, parallel to the poller CatalogLint).

🤖 Generated with Claude Code

…overlay

The SNMP peer configuration was duplicated across all five SNMP-consuming
daemon overlays (collectd, pollerd, provisiond, enlinkd, perspectivepollerd),
forcing every community-string/definition change to be applied five times.

Establish a single committed source at deploy/overlays/shared/etc/snmp-config.xml
and fan it out at image-build time via a new stage_shared_snmp_config() in
tools/build.sh, mirroring the existing stage_shared_poller_catalog() mechanism;
the generated per-daemon copies are now git-ignored. Make build.sh sourceable
(BASH_SOURCE guards around version resolution and main) so a drift-guard test
(tools/stage-shared-snmp-config.test.sh) can exercise the real staging function.

No runtime change: each daemon still loads its local etc/snmp-config.xml at boot.
Verified via full `make images` + `make up PROFILE=full` — all five images carry
the byte-identical staged config and the daemons log loading it from
/opt/deltav/etc/snmp-config.xml.

Assisted-by: ClaudeCode:claude-opus-4-8
Signed-off-by: Ronny Trommer <ronny@no42.org>
@indigo423
indigo423 requested a review from pbrane as a code owner June 26, 2026 10:14
@pbrane
pbrane merged commit cf8957b into develop Jul 2, 2026
4 checks passed
@pbrane
pbrane deleted the refactor/consolidate-shared-snmp-config branch July 2, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants