On Thursday, August 6, 2015 at 5:39:40 PM UTC-5, robert.davidson wrote:
>
> First of all: I'm running puppet 3.6.2, as we are not in a position to 
> move to Puppet 4 yet/ 
>
> When I try to apply an array of tags to an exported resource, as I should 
> be able to according to docs (
> https://docs.puppetlabs.com/puppet/3.6/reference/lang_tags.html#the-tag-metaparameter),
>  
> the tags simply do not apply, and thus collectors fail to function 
> correctly. If I apply only a single tag, it works fine. 
>
> This works: 
> @@module::hostentry{ $::fqdn: 
>    tag => 'host.example.com', 
> }                                                                         
>             
> Module::Hostentry <<| tag != 'host.example.com' |>> 
>
> This does not - fails with duplicate resource errors, because we already 
> have a host entry for the machine defined elsewhere: 
> @@module::hostentry{ $::fqdn: 
>    tag => ['host.example.com'], 
> }                                                                         
>             
> Module::Hostentry <<| tag != 'host.example.com' |>> 
>
>
> My actual code is trying to use more than one tag, and looks more like 
> this, which again, works if I cut it down to a single tag on the resource: 
>
> @@module::hostentry{ $::fqdn: 
>    tag => [$::fqdn, $::site], 
> }                                                                         
>             
> Module::Hostentry <<| tag ==$::site and tag != $::fqdn|>> 
>
>
> I must be doing  *something* wrong here, since I haven't been able to turn 
> up anyone else complaining about this, and something that is so contrary to 
> what the documentation says would surely have hit someone else before now! 
>
>

Per the docs 
<https://docs.puppetlabs.com/puppet/3.6/reference/lang_collectors.html#search-expressions>,
 
there is a bit of asymmetry between the '==' and '!=' operators in search 
expressions:

   - For ==, "this operator will *match* if the value of the attribute (or 
   one of the value’s members, if the value is an array) is identical to the 
   search key."
   - For !=, "This operator will always match if the attribute’s value is 
   an array."

Both behaviors make sense (in particular, a scalar value certainly isn't 
equal to any array), but they are not proper opposites of each other with 
respect to arrays, as one might reasonably expect them to be.


John

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/878a121c-05ab-4a78-b2ab-f63bc4633341%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to