On Sun, Jul 31, 2016 at 3:05 PM, R.I.Pienaar <[email protected]> wrote: > hello, > > I am trying to selectively find classes using PQL that has a certain > parameter. > > class foo($server=true) { > } > > So with PQL I have no idea how to match only foo classes where server = true, > it > appears from errors that it does support search parameters but nothing in the > docs and I can't figure it out.
In the current version of PQL, you can't query against parameters. It's under development though: https://github.com/puppetlabs/puppetdb/pull/2000 In the future, you should be able to query parameters with resources { type = "Class" and title = "Foo" and parameters.server = true } What you can do now, however, is use the AST query language: ["from", "resources", ["and", ["=", "type", "Class"], ["=", "title", "Foo"], ["=", ["parameter", "server"], true]]] This will do the same thing as the PQL except it works in the current version of PuppetDB. It's not quite as convenient, but at least it works. > So then I tried to query via tags which does work, I figured I'll ta the > class using tag(): > > class foo($server=true) { > if $server { > tag("foo_server") > } > > if tagged("foo_server") { > notify{"it's tagged": } > } > } > > this code runs, and the notify fires, however if I query puppet db using a > simple > resources {type = "Class" and title = "Foo"} the tag set with the function > does not > appear on the class. > > So back to not having anyway to find nodes where foo::server = true, any > ideas? > > --- > R.I.Pienaar > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/994494591.394148.1470002741906.JavaMail.zimbra%40devco.net. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CAHTHiAGmxN7VKW%2BtUH5gcgUy3Ys5NWaTHirP9xC3zb%2B-49UPEA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
