Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make pillar top_matches work with node groups #47421

Merged
merged 5 commits into from May 9, 2018

Conversation

@mattp-
Copy link
Collaborator

@mattp- mattp- commented May 1, 2018

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.

@mattp- mattp- requested a review from as a code owner May 1, 2018
@ghost ghost self-requested a review May 1, 2018
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.
@mattp- mattp- force-pushed the nodegroup-topfile branch from 6bf5330 to 0f4b64b May 2, 2018
salt/minion.py Outdated
return False
# if we encounter a node group, just evaluate it in-place
decomposed = salt.utils.minions.nodegroup_comp(target_info['pattern'], nodegroups)
words = decomposed + words
Copy link
Contributor

@isbm isbm May 7, 2018

You can do it with less of coding:

words[0:0] = salt.utils.minions.nodegroup_comp(target_info['pattern'], nodegroups)

Copy link
Collaborator Author

@mattp- mattp- May 7, 2018

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.

mattp- added 2 commits May 7, 2018
we may receive '' empty-string for nodegroup expansions, so we must account for
that safely.
@mattp- mattp- force-pushed the nodegroup-topfile branch from e84e8d4 to c7b0891 May 7, 2018
@mattp-
Copy link
Collaborator Author

@mattp- mattp- commented May 7, 2018

@rallytime i believe this should be good to go now

@mattp- mattp- force-pushed the nodegroup-topfile branch from 2de0afe to f1dbb56 May 8, 2018
isbm
isbm approved these changes May 9, 2018
@rallytime rallytime merged commit ffe507d into saltstack:develop May 9, 2018
4 of 10 checks passed
@corywright
Copy link
Contributor

@corywright corywright commented May 9, 2018

Dreams can come true!

Thanks @mattp-!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants