-
-
Notifications
You must be signed in to change notification settings - Fork 881
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
bool2nginx function #457
Comments
Now that module_data is not being used exactly, is this still needed? |
I still think it has value. Values passed through from Hiera face the same issue. I'd change the function used in puppetlabs-apache and only check for literal booleans, and convert those to on/off, and pass anything else through as is (the function in puppetlabs-apache also checks for strings with value It could also be used in places to clean up the templates a bit and remove a bunch of conditionals (like in https://github.com/puppetlabs/puppetlabs-apache/pull/1400/files) That said, I'm not going to work on this, and it doesn't seem like anyone else will run with it, so no problem if you want to close it. |
Yeah, I guess that was my main worry -- that it would treat the strings 'true' / 'false' as booleans, which I think would be a little regressive, given how Puppet 4 stops doing that 'magic' conversion of booleans to strings in most cases. When you say convert to on / off, do you mean you'd be using on / off internally? I will leave this open for now... we will probably need something similar to this if we undertake another round of structural maintenance. |
For a simple contrived example, if I wanted to set
I would expect So yes, using on / off internally when the template is populated, and only for parameters that have on, off, and potentially other valid values in the nginx config (like ssl_verify_client). |
@igalic @bastelfreak Just mentioning this old thread again... It would be cool to have true / on and false / off work the same way, but maybe not at the cost of not being able to have things be undef. Can an enum be undef? |
Looks like you can use Optional for that:
I'm not sure this is so relevant anymore though. Also nginx doesn't really treat on/off as boolean, since many directives accept on, off, or something else... |
Cool, let's close this then. |
#453 will introduce ripienaar's module_data module. In YAML
on
andoff
are treated as booleantrue
andfalse
, but this module expects strings, soon
andoff
will have to be quoted in YAML.Consider using an equivalent function to bool2httpd from puppetlabs-apache: puppetlabs/puppetlabs-apache@d2ad8ec
This would allow both booleans and strings to be used interchangeably, allowing users to choose whichever style suits them while avoiding this potential YAML gotcha.
The text was updated successfully, but these errors were encountered: