Greetings,

I have a puppetdb installation that I leverage by querying from my 
manifests.

I'd like to have a boolean-like operation for puppetdb that pretty much 
tests if the current node has a given class as part of the catalog. Here is 
my current code:

        $query = [ 
            'resources[certname] {',
            'type = "Class"',
            'and',
            "title = \"fail2ban\"",
            'and',
            "certname = \"${trusted['certname']}\"",
            '}',
        ]
        $this_host_has_fail2ban = puppetdb_query(
            $query.join(' ')
        ).map |$entity| {
            $entity["certname"]
        }

        if "${trusted['certname']}" in $this_host_has_fail2ban {
            $shall_allow_from_internet = true
        }
        else {
            $shall_allow_from_internet = false
        }

Is there a simpler mechanism to find out if a node has a given class in its 
catalog?

Thanks for any help!

-m

-- 
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/bc6d5bf6-df6f-4850-ab35-59edc49e13c6n%40googlegroups.com.

Reply via email to