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

possibility to change the default operator for regexp #29

Closed
wants to merge 1 commit into from

Conversation

beudbeud
Copy link

I had the possibility to use the AND operator for affect the default group.

@GregSutcliffe
Copy link
Member

Apologies for the delay in replying, life's been crazy and I've let this plugin rot for too long :)

if Setting[:use_and_operator] == true
true
else
false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you're saying if true, return true, then this can be simplified to just

return Setting[:use_and_operator]

That avoids the if block entirely.

if Setting[:use_and_operator] == true
return false if not Regexp.new(fact_regex).match(host_fact_value)
else
return true if Regexp.new(fact_regex).match(host_fact_value)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice if we could simplify this block a bit... I'll have a think.

# Set the defaults
Setting[:force_hostgroup_match] = false
Setting[:force_hostgroup_match_only_new] = true
Setting[:force_host_environment] = true
Setting[:use_and_operator] = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will ensure the "OR" code is still tested, but are you able to add tests for the "AND" case?

@ares
Copy link
Member

ares commented May 26, 2021

I appologize, this plugin has not been maintained for a long time. Given it has now conflicts, I'm closing. I'll try to find an active maintainer, please consider reopening after the rebase.

@ares ares closed this May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants