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

Projects
None yet
5 participants
@mattp-
Copy link
Contributor

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 saltstack/team-core as a code owner May 1, 2018

@salt-jenkins salt-jenkins requested a review from saltstack/team-suse May 1, 2018

make pillar top_matches work with node groups
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 bloomberg:nodegroup-topfile branch from 6bf5330 to 0f4b64b May 2, 2018

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

This comment has been minimized.

Copy link
@isbm

isbm May 7, 2018

Contributor

You can do it with less of coding:

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

This comment has been minimized.

Copy link
@mattp-

mattp- May 7, 2018

Author Contributor

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 some commits May 7, 2018

account for failed expansions of nodegroups
we may receive '' empty-string for nodegroup expansions, so we must account for
that safely.

@mattp- mattp- force-pushed the bloomberg:nodegroup-topfile branch from e84e8d4 to c7b0891 May 7, 2018

@mattp-

This comment has been minimized.

Copy link
Contributor Author

commented May 7, 2018

@rallytime i believe this should be good to go now

@mattp- mattp- force-pushed the bloomberg: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

jenkins/PR/salt-pr-linode-cent7-py3 Pull Requests » Salt PR - Linode CentOS 7 - PY3 #4787 — ABORTED
Details
jenkins/PR/salt-pr-linode-ubuntu16-py3 Pull Requests » Salt PR - Linode Ubuntu16.04 - PY3 #9752 — ABORTED
Details
jenkins/PR/salt-pr-rs-cent7-n Pull Requests » Salt PR - RS CentOS 7 #18842 — ABORTED
Details
codeclimate 2 issues to fix
Details
jenkins/PR/salt-pr-linode-ubuntu14-n Pull Requests » Salt PR - Linode Ubuntu14.04 #22712 — FAILURE
Details
default Build started sha1 is merged.
Details
WIP ready for review
Details
jenkins/PR/salt-pr-clone Pull Requests » Salt PR - Clone #24962 — SUCCESS
Details
jenkins/PR/salt-pr-docs-n Pull Requests » Salt PR - Docs #17080 — SUCCESS
Details
jenkins/PR/salt-pr-lint-n Pull Requests » Salt PR - Code Lint #21700 — SUCCESS
Details
@corywright

This comment has been minimized.

Copy link
Contributor

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
You can’t perform that action at this time.