Issue #6412 has been updated by Peter Meier.

> [...] Regex comparison against /^$/ appears to work.

Make the regexp correctly readable:

<pre>
/^$/ appears to work
</pre>

----------------------------------------
Bug #6412: Can not test hash key exist?, or array element exist? in puppet
https://projects.puppetlabs.com/issues/6412

Author: Nan Liu
Status: Accepted
Priority: Normal
Assignee: 
Category: language
Target version: 
Affected Puppet version: 2.6.4
Keywords: 
Branch: 


The following tests fails in puppet for both array and hash:

    $a=['1', '2', '3']
    if $a[4] {
      notice ("a[4] exists.")
    }


    $b={}
    $b['bar'] = 'foo'
    if $b['baz'] {
      notice ("b['baz'] exists.")
    }

The test is actually checking for the existence of variable $a, $b, testing 
using == undef, == '' does not correct this behavior.


-- 
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