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

MCOP-67 make runall work with compound filters #31

Merged
merged 1 commit into from Jun 11, 2014

Conversation

Projects
None yet
3 participants
@jantman
Contributor

jantman commented Jun 4, 2014

... by munging the compound filter array to sandwich the user-specified filter inside an and'ed "puppet.enabled()==true" filter

This would be a lot easier if there was a way to get the compound_filter (-S) string from the client, but there doesn't seem to be... it's converted into a filter array by the Matcher before we have access to the client. So, the best I could come up with is to do some rather unsightly array munging on the compound filter array.

This performs the equivalent to sandwiching the user-specified filter between "puppet.enabled()==true and (" and ")"

@puppetcla

This comment has been minimized.

Show comment
Hide comment
@puppetcla

puppetcla Jun 4, 2014

CLA signed by all contributors.

puppetcla commented Jun 4, 2014

CLA signed by all contributors.

@ploubser

This comment has been minimized.

Show comment
Hide comment
@ploubser

ploubser Jun 6, 2014

Contributor

This is great, thank you. I think it would be useful to warn the user that the filter is being modified.

Contributor

ploubser commented Jun 6, 2014

This is great, thank you. I think it would be useful to warn the user that the filter is being modified.

@jantman

This comment has been minimized.

Show comment
Hide comment
@jantman

jantman Jun 9, 2014

Contributor

@ploubser I've added a note to the usage message per your comment here and in Jira. Do you think that's sufficient, or should it puts something when the command is run as well? @ripienaar any further thoughts on this?

Contributor

jantman commented Jun 9, 2014

@ploubser I've added a note to the usage message per your comment here and in Jira. Do you think that's sufficient, or should it puts something when the command is run as well? @ripienaar any further thoughts on this?

@client.filter["compound"].clear
@client.compound_filter("puppet().enabled=true")
unless @client.filter["compound"].empty?
# munge the filter to and it with checking for enabled nodes

This comment has been minimized.

@ploubser

ploubser Jun 10, 2014

Contributor

It would be handy if we logged at warning or info that we were going to manipulate the filter.

@ploubser

ploubser Jun 10, 2014

Contributor

It would be handy if we logged at warning or info that we were going to manipulate the filter.

This comment has been minimized.

@jantman

jantman Jun 10, 2014

Contributor

Ok, added that in 63d0422

@jantman

jantman Jun 10, 2014

Contributor

Ok, added that in 63d0422

@client.compound_filter("puppet().enabled=true")
unless @client.filter["compound"].empty?
# munge the filter to and it with checking for enabled nodes
log("Modifying user-specified filter: and'ing with 'puppet().enabled=true'")

This comment has been minimized.

@ploubser

ploubser Jun 10, 2014

Contributor

Thanks. This is going to break the tests because runner.logger will not have been initiated. Work around would be to set runner.logger or to stub out the log method call in that specific test.

@ploubser

ploubser Jun 10, 2014

Contributor

Thanks. This is going to break the tests because runner.logger will not have been initiated. Work around would be to set runner.logger or to stub out the log method call in that specific test.

@jantman

This comment has been minimized.

Show comment
Hide comment
@jantman

jantman Jun 10, 2014

Contributor

Oops. Thanks for catching that. Updating.

Contributor

jantman commented Jun 10, 2014

Oops. Thanks for catching that. Updating.

Show outdated Hide outdated util/puppetrunner.rb
@ploubser

This comment has been minimized.

Show comment
Hide comment
@ploubser

ploubser Jun 11, 2014

Contributor

Made two last comments to the commit. This looks great. When you're done, if you could rebase this into a single commit I will be happy to merge it.

Thanks!

Contributor

ploubser commented Jun 11, 2014

Made two last comments to the commit. This looks great. When you're done, if you could rebase this into a single commit I will be happy to merge it.

Thanks!

MCOP-67 make runall work with compound filters, by munging the compou…
…nd filter array to sandwich the user-specified filter inside an and'ed "puppet.enabled()==true" filter
@jantman

This comment has been minimized.

Show comment
Hide comment
@jantman

jantman Jun 11, 2014

Contributor

Done, squashed down to one commit. Just waiting on Travis to confirm.

Thanks!

Contributor

jantman commented Jun 11, 2014

Done, squashed down to one commit. Just waiting on Travis to confirm.

Thanks!

@ploubser

This comment has been minimized.

Show comment
Hide comment
@ploubser

ploubser Jun 11, 2014

Contributor

Merging, thank you!

Contributor

ploubser commented Jun 11, 2014

Merging, thank you!

ploubser added a commit that referenced this pull request Jun 11, 2014

Merge pull request #31 from jantman/MCOP-67
MCOP-67 make runall work with compound filters

@ploubser ploubser merged commit a6d9825 into puppetlabs:master Jun 11, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment