I've released version 1.0.0-pre1 of the dalen-puppetdbquery module, it includes
the old functions against the PuppetDB api version 1.0. But also some entirely
new functions that will query the PuppetDB api v2.0 (in puppetdb 1.1 and up).
These new functions borrow the syntax from Dan Bode's ruby-puppetdb, but are
entirely rewritten to make use of the 2.0 API.
It now uses a lexer and parser written in rex & racc (ruby versions of lex &
yacc) to compile a high level query language into PuppetDB queries.
An example of a high level query would be:
Class[Apache]{service_enable=true} and (osfamily=Redhat or osfamily=Debian)
That would find any host with the apache class (notice though that class names
have to be capitalized in queries) with the parameter service_enable => true
and osfamily red hat or debian. It does normal operator precedence, so a
parenthesis is required around that or-statement.
The three new query functions are:
* query_nodes
* query_facts
* query_resources
So far only query_nodes and query_facts accept the new query language. In all
three functions an array argument instead of string will be treated as a "raw"
puppetdb query.
Anyway, please test it and send me feedback (dalen on freenode). The old
functions are left intact but deprecated, so it shouldn't affect any existing
code using the older functions.
--
Erik Dalén
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/puppet-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.