Issue #8778 has been updated by Jeff McCune.

Nigel Kersten wrote:
> Can we get a tighter scope on this? Is it just undef, or all symbols?

It appears to only affect undef.

Here's my test manifest:

<pre>
notify { 'one': }
notify { 'two': }

$notify_one = Notify[one]
$notify_two = Notify[two]

if undef == undef {
  notice("undef == undef")
}
if undef == '' {
  notice("undef == ''")
}
if '' == undef {
  notice("'' == undef")
}

if $notify_one == $notify_two {
  notice('$notify_one == $notify_two')
}
if $notify_one != $notify_two {
  notice('$notify_one != $notify_two')
}

if $notify_two == $notify_one {
  notice('$notify_two == $notify_one')
}
if $notify_two != $notify_one {
  notice('$notify_two != $notify_one')
}

if true == false {
  notice('true == false')
}
if false == true {
  notice('false == true')
}
if true != false {
  notice('true != false')
}
if false != true {
  notice('false != true')
}
</pre>

And the expected output:
<pre>
notice: Scope(Class[main]): undef == undef
notice: Scope(Class[main]): undef == ''
notice: Scope(Class[main]): $notify_one != $notify_two
notice: Scope(Class[main]): $notify_two != $notify_one
notice: Scope(Class[main]): true != false
notice: Scope(Class[main]): false != true
notice: one
notice: /Stage[main]//Notify[one]/message: defined 'message' as 'one'
notice: two
notice: /Stage[main]//Notify[two]/message: defined 'message' as 'two'
notice: Finished catalog run in 0.02 seconds
</pre>
----------------------------------------
Bug #8778: Equality in Puppet is not commutative
https://projects.puppetlabs.com/issues/8778

Author: Jeff McCune
Status: Needs More Information
Priority: Normal
Assignee: Jeff McCune
Category: parser
Target version: 
Affected Puppet version: 
Keywords: 
Branch: 


# Overview #

The equality (`==`) test in Puppet is not commutative in combination with the 
undef value.

All three notices should print OR only "undef == undef" should print.  Two 
notices should NOT print.
<pre>
if undef == undef {
  notice("undef == undef")
}
if undef == '' {
  notice("undef == ''")
}
if '' == undef {
  notice("'' == undef")
}
</pre>

# Actual Behavior #

Notice that undef == '' but not '' == undef.

<pre>
notice: Scope(Class[main]): undef == undef
notice: Scope(Class[main]): undef == ''
notice: Finished catalog run in 0.02 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.

Reply via email to