On Thu, Mar 07, 2013 at 12:43:26PM -0800, Nick Fagerlund wrote: > > 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.
Yeah that appears to be the bug report, and is to be limited to auto-lookups from parameterized classes/data binding. In the YAML spec, similar to many languages (including puppet DSL), true/false must be unquoted. Otherwise 'true' = a string containing the word true, which evaluates to true, as does the string 'false'. Classy workaround sir, I will apply liberally. -- Richard Clark rich...@fohnet.co.uk
signature.asc
Description: Digital signature