Issue #8705 has been reported by Dan Bode.
----------------------------------------
Bug #8705: undefined hash values are not interpreted as false
https://projects.puppetlabs.com/issues/8705
Author: Dan Bode
Status: Unreviewed
Priority: Normal
Assignee:
Category:
Target version:
Affected Puppet version:
Keywords:
Branch:
I expect that undefined hash keys would evaluate to a false value
<pre>
$my_hash = {'one' => 1}
if $my_hash[2] {
notice('we should not get here')
}
:!puppet apply /tmp/foo.pp
notice: Scope(Class[main]): we should not get here
notice: Finished catalog run in 0.04 seconds
</pre>
Adding quotes to the expression does not change the behavior, but assigning it
to a variable and using quotes on the variable results in the expected behavior.
<pre>
$my_hash = {'one' => 1}
$var = $my_hash[2]
if "$my_hash[2]" {
notice('we should not get here')
}
if "$var" {
notice('we should not get here either')
}
puppet apply /tmp/foo.pp
notice: Scope(Class[main]): we should not get here
notice: Finished catalog run in 0.04 seconds
</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.