Add support for default node fallback. #43
Closed
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.
Add an additional optional configuration parameter 'default_node' which when a node is lacks a yml config file it falls back to provide data from this default node. The point of this is to allow the equivalent of '*': in a salt pillar/top.sls file. With this patch you can still target pillar data to minions which you don't have corresponding minion_id nodes defined. Either by hard coding parameters/classes in the default_node yaml file or with class_mappings regexes in the reclass-config.yml.
This parameter defaults to None when unset. This causes the same behavior as pre-patch (exception thrown on node not found).
I haven't pushed this change into the salt top module because I don't use this functionality and so can't easily test. I believe this behavior could be implemented by adding a default_node kwarg to top() and when storage adaptor is initialized. I don't have ansible infrastructure to test with so I've made no changes to the ansible/* code. reclass-ansible behavior appears unchanged (as expected) since it's just ignoring an extra kwarg passed from the cli module.