Count number of (collected) external resources

44 views
Skip to first unread message

Frederik Wagner

unread,
Sep 25, 2014, 7:11:26 AM9/25/14
to puppet...@googlegroups.com
Hi group,

is there a way to count the number of resources of a specific type
(with a specific tag) included in the catalog?

In more detail:
In a manifest I collect external resources like:
External::Resource <<| tag == 'tagged_resource' |>>

Now I would like to know how many resources are actually collected, so
I would like to have/write a function
$num_res = count_resources( External::Resource, { 'tag' =>
'tagged_resource' } )
to be used in the rest of the manifest.

Is there a way to realize this in a custom function? I suppose there
is, but I'm missing the right API calls.

Thanks a lot for any hints in the right direction.

Bye
Frederik

Yanis Guenane

unread,
Sep 25, 2014, 11:33:43 PM9/25/14
to puppet...@googlegroups.com
Hi Frederik,

I think that puppetdbquery[1] can do what you're looking for.

Take a look a it,

[1] https://forge.puppetlabs.com/dalen/puppetdbquery

--
Yanis Guenane

Frederik Wagner

unread,
Sep 26, 2014, 2:15:29 AM9/26/14
to puppet...@googlegroups.com
Hi Yanis,

thanks for the hint. Sounds reasonable - I'll check it out!

Bye
Frederik
> --
> 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...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/5424DE88.80205%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages