make pillar top_matches work with node groups - #47421
Merged
Merged
Conversation
ghost
self-requested a review
May 1, 2018 21:00
the compound match evaluator to date relied callers to pre-evaluate nodegroups into their decomposed state. in some places this wasn't happening. Rather than fix every call site, teach compound_match to evaluate nodegroups in place. It seems matchers were refactored to salt.utils.minions at some point but the original minion.py matcher was not ported to use it. Given the hugeness of that change, i've left as is and ported my fix to salt.utils.minions as well instead.
cachedout
approved these changes
May 7, 2018
isbm
suggested changes
May 7, 2018
Contributor
There was a problem hiding this comment.
You can do it with less of coding:
words[0:0] = salt.utils.minions.nodegroup_comp(target_info['pattern'], nodegroups)
Contributor
Author
There was a problem hiding this comment.
i realized that nodegroup_comp on failure returns '' and fixed that. I think [0:0] would still work, but i think its clearer intent leaving the if "contents:\nprepend" style of what the code is doing.
we may receive '' empty-string for nodegroup expansions, so we must account for that safely.
Contributor
Author
|
@rallytime i believe this should be good to go now |
isbm
approved these changes
May 9, 2018
Contributor
|
Dreams can come true! Thanks @mattp-! |
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 does this PR do?
the compound match evaluator to date relied callers to pre-evaluate nodegroups
into their decomposed state. in some places this wasn't happening. Rather than
fix every call site, teach compound_match to evaluate nodegroups in place.
It seems matchers were refactored to salt.utils.minions at some point but the
original minion.py matcher was not ported to use it. Given the hugeness of that
change, i've left as is and ported my fix to salt.utils.minions as well
instead.
What issues does this PR fix or reference?
this should fix #6602
Previous Behavior
nodegroup in compound didn't work.
New Behavior
it works.
Tests written?
Yes
Commits signed with GPG?
No
Please review Salt's Contributing Guide for best practices.
See GitHub's page on GPG signing for more information about signing commits with GPG.