On 8 March 2013 06:43, Nick Fagerlund <[email protected]> wrote:
> > > On Thursday, March 7, 2013 11:28:23 AM UTC-8, Jakov Sosic wrote: >> >> On 03/07/2013 02:41 PM, llowder wrote: >> > >> > >> > On Thursday, March 7, 2013 6:38:52 AM UTC-6, Ahmed Kamal wrote: >> > >> > I'm on 3.1, and I'm finding that "true" works as expected, but >> > "false" does not! I think "false" is interpreted as "undef" or so, >> > thus taking value from the module's default params >> > > Yeah it's definitely a bug, but I think it's > http://projects.puppetlabs.com/issues/17105 -- not sure when it'll be > fixed, but I know they're working on it and consider it serious. > > If you need it to work today, you can use the "sloppy bools" pattern, and > use a string (instead of a real bool) in your hiera data: > > class myclass ($myparam) { > $myparam_real = str2bool("$myparam") > #... use $myparam_real everywhere below here. > } > > --- > myclass::myparam: "false" > > This will make it so $myparam can be a string, a real boolean, or a number > (0/1), and still work fine. Note the quotes in the str2bool call; those > make it so you can later change the hiera data to a real bool (after the > bug is fixed) without changing your code. Awesome! I was attempting to think of a quick fix for the problem but hadn't gotten around to it. My solution was to set the vars in each node definition but this idea is nicer Thanks Nick! > > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
