Issue #18234 has been updated by Peter Meier.
Andrew Hendry wrote: > Thanks for the pointer. > Changing the line you mentioned to this appears to be working so far our on > 2.7.14 puppet master. > [...] I would try to omit is_a? <pre> value = object[array_index_or_key(object, accesskey)] if value.nil? :undef else value end </pre> Or a less verbose solution would be <pre> (value=object[array_index_or_key(object, accesskey)]).nil? ? :undef : value </pre> ---------------------------------------- Bug #18234: Booleans used from within hashes not working correctly. https://projects.puppetlabs.com/issues/18234#change-79399 Author: Andrew Hendry Status: Accepted Priority: Normal Assignee: Category: language Target version: Affected Puppet version: Keywords: puppet hashes booleans defaults evaluation Branch: booleans_from_hashes.pp <pre>$puppet_hash = { hflag1 => true, hflag2 => false } notice("hflag1 should be true = '${puppet_hash[hflag1]}'") notice("hflag2 should be false = '${puppet_hash[hflag2]}'") dummy {'fromhash': flag1 => $puppet_hash[hflag1], flag2 => $puppet_hash[hflag2] } dummy {'assigned': flag1 => true, flag2 => false } define dummy ( $flag1 = true, $flag2 = true, ) { notice("${name} flag1 should be true = '${flag1}'") notice("${name} flag2 should be false = '${flag2}'") } </pre> Output: <pre> puppet apply booleans_from_hashes.pp notice: Scope(Class[main]): hflag1 should be true = 'true' notice: Scope(Class[main]): hflag2 should be false = '' notice: Scope(Dummy[fromhash]): fromhash flag1 should be true = 'true' notice: Scope(Dummy[fromhash]): fromhash flag2 should be false = 'true' notice: Scope(Dummy[assigned]): assigned flag1 should be true = 'true' notice: Scope(Dummy[assigned]): assigned flag2 should be false = 'false' notice: Finished catalog run in 0.04 seconds </pre> <pre> puppet --version 2.7.14 ruby --version ruby 1.8.7 (2010-06-23 patchlevel 299) [x86_64-linux] </pre> flag2 should be false when pulled from the hash but it appears to be empty, resulting in the default being used. This does not happen when passing booleans directly. Does anyone know a workaround or fix? -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
