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

Use str2bool() from stdlib #124

Closed
daenney opened this issue Jan 4, 2014 · 3 comments
Closed

Use str2bool() from stdlib #124

daenney opened this issue Jan 4, 2014 · 3 comments

Comments

@daenney
Copy link

daenney commented Jan 4, 2014

I accidentally stumbled on your Puppet files and started looking into them. There's a few places where you do the following:

if $var != true and $var != 'true' {
..
}

You can avoid that by calling out to the str2bool() function from puppetlabs-stdlib which is already a dependency according to your Modulefile. str2bool() will return the boolean if a boolean is passed in.

This in turn now allows you to simply do:

if str2bool($var) != true {
...
}

This will cover both the boolean true and the string 'true'.

@jlambert121
Copy link
Contributor

Yeah, thanks for pointing that out. That was thrown in (in a poor way) to take into account hiera's dislike of false. I started rewriting the module earlier today to fix #123's issues (and some I've ignored) and have thrown this in as well already as the two conditionals are just a nasty hack.

@daenney
Copy link
Author

daenney commented Jan 4, 2014

Ah yes, that's always fun. People just need to use the bare words yes and no in that case but just about no one does.

@jamtur01
Copy link
Contributor

jamtur01 commented Jan 6, 2014

This is fixed via #126.

@jamtur01 jamtur01 closed this as completed Jan 6, 2014
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

No branches or pull requests

3 participants