Issue #18234 has been updated by Andrew Hendry.


<pre>
notice: Scope(Dummy[assigned]): assigned flag2 should be false = 'false'
notice: Scope(Dummy[fromhash]): fromhash flag2 should be false = 'true'
</pre>

Moving from assigned to fromhash is the case we found this, converting older 
modules/manifests to hiera/create_resources. So we'll need to run this locally, 
or refactor out all the booleans to continue moving to hiera.

Happy to leave this as documentation for a future language changing release, 
but should a warning be added?

Also is there any plan to implement something like LANGUAGE_COMPAT=3.0.2 to 
support language fixes between major releases? 

----------------------------------------
Bug #18234: Booleans used from within hashes not working correctly.
https://projects.puppetlabs.com/issues/18234#change-79730

Author: Andrew Hendry
Status: In Topic Branch Pending Review
Priority: Normal
Assignee: Andrew Hendry
Category: language
Target version: 
Affected Puppet version: 2.7.14
Keywords: puppet hashes booleans defaults evaluation
Branch: https://github.com/puppetlabs/puppet/pull/1357


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.

Reply via email to