Resolve nested and module-default manage toggles in the Hiera data check#33
Merged
Merged
Conversation
The Hiera data-versus-surface advisory resolved a `manage` toggle only at the top level of a parameter and only from the consumer's own data layers. Toggles nested in a sub-hash (packages.sources.manage, standalone.self_update.manage) and toggles left at their module default were outside that model, so a value the module never reads produced no advisory. Resolve `manage` at any depth, judging each subkey against the nearest enclosing toggle on its own path, and read each deployed module's own data layer as the lowest-priority source so a toggle left at its default resolves instead of being skipped. With defaults readable, a consumer value that differs from the module default is flagged while a mere restatement of the default is suppressed as inert.
Add two real-module fixtures and specs for the extended advisory resolution: packages.sources.* with sources.manage left at the module default, and standalone.self_update.* with the loop toggle at its module default under an enclosing standalone.manage: true. Each asserts the differing subkey is flagged and the restated default is spared; mutation-checked against disabling nested descent, the module-data read, and the default comparison.
Update the "Validating Hiera data in CI" advisory and stated-limits bullets, and the CHANGELOG entry for the data check, to reflect that the advisory now resolves a `manage` toggle wherever it sits (including nested toggles and toggles left at their module default) and spares a subkey that merely restates the default.
The advisory said "effective 'manage' is false" even when the flagged subkey sat under a nested toggle while the parent was enabled, pointing at the wrong toggle. Name the toggle that disables each subkey (`manage`, `sources.manage`, `self_update.manage`), emitting one line per governing toggle so subkeys under different toggles of the same key are each attributed correctly.
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.
Closes #27.
Changes
The data check's advisory flags configuration you set that the module won't act on. It only inspected a top-level
managetoggle in your own data, so two real cases slipped through: toggles nested in a sub-hash, and toggles left at the module's default.Concretely, this used to pass silently:
packages.sources.managedefaults tofalse(the module manages apt sources only when asked), so thatlocationis never read: the mirror silently does nothing, and the check said nothing either.Now the advisory catches it and names the exact toggle:
It resolves
manageat any depth, reads each module's own defaults as the lowest-priority layer (so a toggle left at its default is still caught), and stays quiet when a subkey merely restates the default. Still non-failing; exit codes unchanged.Verification
just checkgreen (122 examples, 0 failures; docs-check PASS).nested_default_sources,nested_self_update), mutation-checked against disabling nested descent, the module-data read, and the default comparison.