Skip to content

feat: Provisioner::Config module, recipes.d support, ipmap.yaml fallback#60

Draft
troglodyne-bot wants to merge 1 commit into
Troglodyne-Internet-Widgets:masterfrom
troglodyne-bot:koan/recipes-d-ipmap-global
Draft

feat: Provisioner::Config module, recipes.d support, ipmap.yaml fallback#60
troglodyne-bot wants to merge 1 commit into
Troglodyne-Internet-Widgets:masterfrom
troglodyne-bot:koan/recipes-d-ipmap-global

Conversation

@troglodyne-bot

Copy link
Copy Markdown
Contributor

What

New Provisioner::Config module centralises all config loading for bin/new_config and bin/ipmap2zones. Adds recipes.yaml.d/ drop-in support alongside existing recipes.d/, and lets _base._global in recipes.yaml replace ipmap.cfg entirely.

Why

Three open issues point at the same root problem — config loading is scattered and inflexible:

How

  • lib/Provisioner::Config — new OO module with two memoised methods: recipe_config() (merges base yaml + both drop-in dirs) and ipmap() (reads ipmap.cfg or falls back to _base._global). Drop-in files have _base/_shared stripped to prevent shadowing.
  • bin/new_config — delegates get_config and get_recipe_config to the module; $_cfg is reset when CLI options change paths.
  • bin/ipmap2zones — gains --recipes flag and the same YAML fallback via the module.
  • README.md — documents the YAML consolidation pattern and the drop-in dirs.

Testing

t/config.t covers: missing recipes file, basic load, recipes.d merge, recipes.yaml.d merge, _base/_shared stripping, both dirs together, YAML fallback (no ipmap.cfg), and ipmap.cfg taking precedence when both exist. Requires project deps (YAML, Hash::Merge, File::Slurper, Config::Simple).

Closes #45, #46, #55.

Closes Troglodyne-Internet-Widgets#45, Troglodyne-Internet-Widgets#46, Troglodyne-Internet-Widgets#55.

- New Provisioner::Config module centralises recipe and ipmap loading.
  Both bin/new_config and bin/ipmap2zones now delegate to it.
- recipes.d/ and recipes.yaml.d/ directories are both searched for
  drop-in YAML fragments; missing dirs are silently skipped.
- When ipmap.cfg is absent, _base._global in recipes.yaml serves as a
  complete replacement: ips, aliases, nameservers, addons keys plus all
  scalar globals (basedir, admin_user, tld, gateway, etc.).
- ipmap2zones gains a --recipes flag and the same YAML fallback.
- t/config.t covers recipe merging, drop-in dir handling, YAML fallback,
  and ipmap.cfg precedence.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

Re-factor ipmap.cfg to be inside of the _global section of recipes.yaml

1 participant