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

Validate the values of $merge_behavior #51

Merged
merged 1 commit into from
Mar 6, 2015

Conversation

tampakrap
Copy link
Contributor

This introduces dependency to puppetlabs/stdlib module

@elyscape
Copy link
Contributor

elyscape commented Feb 8, 2015

The dependency on stdlib isn't necessary. Instead of using validate_re, you should be able to do something like:

unless $merge_behavior in ['native', 'deep', 'deeper'] {
  fail("Invalid merge behavior: ${merge_behavior}")
}

@tampakrap
Copy link
Contributor Author

Thanks for the review, I rebased my PR

@@ -134,6 +134,10 @@
ensure => directory,
}
}
if $merge_behavior {
unless $merge_behavior in ['native', 'deep', 'deeper'] {
fail("${merge_behavior} merge behavior is invalid. Valid values are: native, deep, deeper")
Copy link
Contributor

Choose a reason for hiding this comment

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

this is now missing a }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks, fixed

if $merge_behavior {
unless $merge_behavior in ['native', 'deep', 'deeper'] {
fail("${merge_behavior} merge behavior is invalid. Valid values are: native, deep, deeper")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

now wondering if puppet optimizes this down to:

if $merge_behavior and !($merge_behavior in ['native', 'deep', 'deeper']) {

:P

Copy link
Contributor

Choose a reason for hiding this comment

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

logic is hard…

Copy link
Contributor

Choose a reason for hiding this comment

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

Hah, good point. That might be a better way to specify that check.

hunner added a commit that referenced this pull request Mar 6, 2015
Validate the values of $merge_behavior
@hunner hunner merged commit e885d2a into voxpupuli:master Mar 6, 2015
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.

4 participants