Re: [Puppet Users] boolean like operation for puppetdb query

2022-02-16 Thread 'Matt Zagrabelny' via Puppet Users
Hey Daniel, Thanks for the reply and hints about "defined". I ended up putting the puppetdb code into a function and calling the function: $ cat modules/util/functions/does_host_have_class.pp function util::does_host_have_class( String $class ) >> Boolean { $func_name = "util::does_host

Re: [Puppet Users] boolean like operation for puppetdb query

2022-02-15 Thread Daniel Krämer
Hi, no answer yet? Or did miss them? I'm not a puppet professional but i may provide some other approaches and an opinion. There is the function defined() https://puppet.com/docs/puppet/7/function.html#defined , but it's tricky because you need to be 100% sure that in your example class fail2ban

[Puppet Users] boolean like operation for puppetdb query

2022-02-11 Thread 'Matt Zagrabelny' via Puppet Users
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 = [ 'resour