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

issue with true and false when using hiera and JSON format ! #60

Closed
fskale opened this issue May 17, 2016 · 3 comments
Closed

issue with true and false when using hiera and JSON format ! #60

fskale opened this issue May 17, 2016 · 3 comments

Comments

@fskale
Copy link

fskale commented May 17, 2016

Hi,
just want let you know, that, when using hiera and JSON as backend, true and false never get matched because of the mssing single quote.
So, basically every JSON encoder will set single or double quotes for every value.
My simple solution: (share.pp)
E.g:
Old:
$read_only ? {
true => "set "${target}/read only" yes",
false => "set "${target}/read only" no",
default => "rm "${target}/read only"",
}

New:
$read_only ? {
'true' => "set "${target}/read only" yes",
'false' => "set "${target}/read only" no",
default => "rm "${target}/read only"",
}

It's also good practice to set strings withing single quotes like:
https://docs.puppet.com/puppet/latest/reference/lang_conditional.html

Rgds.
Franz

@ajjahn
Copy link
Owner

ajjahn commented Jul 8, 2016

@fskale Will this not interfere with values set directly in a manifest?

@warrenpnz
Copy link

The problem here is that you are trying to do 1 of 3 operations with a binary option. Best to just decide on what the actual default will be (t/f) and use that as a default setting with an override:

man smb.conf:
read only (S)
An inverted synonym is writeable.
Default: read only = yes

@fskale
Copy link
Author

fskale commented Jan 23, 2017

I'll close this obsolete issue. Wrote my own class a year ago.

@fskale fskale closed this as completed Jan 23, 2017
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