On Thursday, February 13, 2014 4:23:27 PM UTC+1, jcbollinger wrote:

I think so.  This looks related to 
> https://tickets.puppetlabs.com/browse/PUP-1045.  Moreover, resources get 
> automatic tags that may support what you're after even easier than what 
> you're trying to do.  For example, this model might work:
>
>
> class myname::myclass {
>
>   # no resource defaults needed
>
>   # dependencies
>   User       <| tag == "myname::myclass" |> ->
>   File       <| tag == "myname::myclass" |> ->
>   Service    <| tag == "myname::myclass" |>
>
>   ...
>
> }
>

Hi again,
I'm trying this but for some reason it isn't working.

For example, if I have a File resource to which I assigned a custom 
"post_exec" tag because it needs to be applied after any Exec resource, and 
the following code works fine:

class myname::myclass {

  Exec <| |> ->
  File <| (tag == "post_exec") |>

  ...
}

But if I want to restrict the dependency to my specific class, to prevent 
problems, the following code fails, the dependency is not created (I 
checked the difference with puppet agent --test --graph):

class myname::myclass {

  Exec <| (tag == "myname::myclass") |> ->
  File <| (tag == "myname::myclass") and (tag == "post_exec") |>

  ...
}

Now that I think about it… 
http://docs.puppetlabs.com/puppet/latest/reference/lang_collectors.html tells 
that "Collectors can only search on attributes which are present in the 
manifests and cannot read the state of the target system".
I would not expect the class name tag to only be part of the target system, 
but the automatically created tag is not explicitly present in the 
manifest, either. So maybe that's why my code does not work?
Can resource collectors access automatically created tags in their search 
expressions?

Thanks.
Marco

-- 
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/915e3146-c532-4d68-a3c5-50b73e495631%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to