Issue #21948 has been updated by Charlie Sharpsteen.

Description updated
Category set to language
Assignee set to eric sorenson

Agreed that this is currently behaving as intended. It seems that you are 
looking for is a way to test if the intersection of two sets is empty. In Ruby:

<pre>
(ary1 & ary2).empty?
</pre>

It appears that `==` in Puppet already covers not only equality but, 
surprisingly, 
[inclusion](https://github.com/puppetlabs/puppet/blob/3.2.4/lib/puppet/parser/ast/collexpr.rb#L37-L41).
 I would be wary of further extending `==` to cover intersection as this 
operator strictly covers equality in most programming languages. Each departure 
from this norm could surprise users who are expecting an equality test but end 
up with a test for intersection or even inclusion.

Eric, any thoughts on this one?

----------------------------------------
Feature #21948: resource collection == doesn't compare arrays vs arrays
https://projects.puppetlabs.com/issues/21948#change-98434

* Author: Jeremy Kitchen
* Status: Needs Decision
* Priority: Normal
* Assignee: eric sorenson
* Category: language
* Target version: 
* Affected Puppet version: 
* Keywords: 
* Branch: 
----------------------------------------
given:

<pre>
@user { 'foo':
 groups => ['a','b'],
}

@user { 'bar':
 groups => ['b','c'],
}
</pre>

This is what DOES happen:

<pre>
User<| groups == ['a', 'b'] |> # realizes only user foo
User<| groups == 'b' |> # realizes both, as to be expected
</pre>

So, it would appear that an array on the left hand side is acceptable, but not 
on the right.

This is what I would expect:

<pre>
User<| groups == ['a','b'] |> # realizes both
User<| groups == ['a', 'c'] |> # realizes both
</pre>

I mainly want this so I can do:

</pre>
User<| groups == hiera_array('include_groups') |>
</pre>

I'm using puppet 3.2.3 on both master and agent.

I'm not against doing something like:

<pre>
$include_groups = hiera_array('include_groups')
$include_groups.each { | $group |
 User<| groups == $group |>
}
</pre>

The only problem I have with that is it's experimental and may go away, so I 
don't want to rely upon that functionality if it may not be there next version.

The documentation says it will pull in all resources matching the search key 
(the right hand operand), which I admittedly initially misread, but the fact 
that *anything* gets returned makes me wonder if there's more behind this issue.


-- 
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-bugs.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to