feat: Provisioner::Config module, recipes.d support, ipmap.yaml fallback#60
Draft
troglodyne-bot wants to merge 1 commit into
Draft
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
New
Provisioner::Configmodule centralises all config loading forbin/new_configandbin/ipmap2zones. Addsrecipes.yaml.d/drop-in support alongside existingrecipes.d/, and lets_base._globalinrecipes.yamlreplaceipmap.cfgentirely.Why
Three open issues point at the same root problem — config loading is scattered and inflexible:
_base._globalof recipes.yaml so there's one config file instead of two.recipes.yaml.d/drop-in directory wasn't supported (onlyrecipes.d/).recipes.d/support existed in code but wasn't guarded against a missing directory, and the ipmap consolidation wasn't wired.How
lib/Provisioner::Config— new OO module with two memoised methods:recipe_config()(merges base yaml + both drop-in dirs) andipmap()(readsipmap.cfgor falls back to_base._global). Drop-in files have_base/_sharedstripped to prevent shadowing.bin/new_config— delegatesget_configandget_recipe_configto the module;$_cfgis reset when CLI options change paths.bin/ipmap2zones— gains--recipesflag and the same YAML fallback via the module.README.md— documents the YAML consolidation pattern and the drop-in dirs.Testing
t/config.tcovers: missing recipes file, basic load,recipes.dmerge,recipes.yaml.dmerge,_base/_sharedstripping, both dirs together, YAML fallback (no ipmap.cfg), andipmap.cfgtaking precedence when both exist. Requires project deps (YAML,Hash::Merge,File::Slurper,Config::Simple).Closes #45, #46, #55.