On Wed, Mar 23, 2016 at 3:04 PM, Hunter Haugen <
hun...@puppetlabs.com> wrote:
> Given the resource you want to apply this pattern to, it can be turned into
> a one-liner with a collector:
>
> file { '/tmp/something':
> ensure => file,
> }
> File['/tmp/something'] ~> Service <| title == 'apache2' |>
>
> This means that if there is a service with a title of apache2 EVER added to
> the catalog, it'll be refreshed on file changes. If the service doesn't
> exist, then the dependency does nothing.
>
> Now, this isn't exactly what you asked since you wanted the variable
> $services_to_notify and didn't say what you're going to do with it, but I
> assume this is what you want? Because collectors are not parse-order
> specific, you can't do variable assignments like $services_to_notify =
> Service <| title == 'apache2' |> (because variables are evaluated in parse
> order and collectors are not).
>
> If you really want to make a function that searches the catalog and returns
> references, it can be done with something like
> `scope.catalog.resource('Service[apache2]')` inside the function I believe,
> though that may not be the exact call.
Thanks for the reply, Hunter. I'll dig in and report back if I've got issues.