Issue #10744 has been reported by Jos Boumans.
----------------------------------------
Bug #10744: Hash keys, defined & truth do not work as expected
https://projects.puppetlabs.com/issues/10744
Author: Jos Boumans
Status: Unreviewed
Priority: Normal
Assignee:
Category: functions
Target version: 2.6.x
Affected Puppet version: 2.6.3
Keywords:
Branch:
The following manifest has a few very unexpected outcomes:
<pre>
$h = { "a" => 42 }
if $h["a"] { notice( "if A should print" ) }
if defined( $h["a"] ) { notice( "defined A should print" ) } # doesn't print,
but should
if has_key( $h, "a" ) { notice( "has_key A should print" ) }
if $h["b"] { notice( "if B should not print" ) } # prints but
shouldn't
if defined( $h["b"] ) { notice( "defined B should not print" ) }
if has_key( $h, "b" ) { notice( "has_key B should not print" ) }
if $u { notice( "if U should not print" ) }
if defined( $u ) { notice( "defined U should not print" ) } # runtime
error, but shouldn't
else { notice( "defined U should print else" ) } # doesn't
print, but should
notice( "No execution errors" ) # doesn't reach here, but should
</pre>
Prints the following and exits with code 1:
<pre>
$ puppet apply x.pp
notice: Scope(Class[main]): if A should print
notice: Scope(Class[main]): has_key A should print
notice: Scope(Class[main]): if B should not print
interning empty string at /mnt/tmp/puppet.hash/y.pp:12 on node cc001.krxd.net
</pre>
--
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.