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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Dan Bode
2013-Mar-04 18:00 UTC
Re: [Puppet Users] Beta release of puppetdbquery module 1.0
On Mon, Mar 4, 2013 at 7:59 AM, Erik Dalén <erik.gustav.dalen@gmail.com>wrote:> 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. >I also wanted to make sure that Pieter Loubser and RI Pienaar also got a shout out for helping put together the initial grammar for ruby-puppetdb (it heavily borrowed from mcollective''s syntax, and Piter built the initial parser)> > 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 puppet-users+unsubscribe@googlegroups.com. > To post to this group, send email to puppet-users@googlegroups.com. > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Stephen Price
2013-Mar-28 16:31 UTC
[Puppet Users] Re: Beta release of puppetdbquery module 1.0
Guys, Can you expand the README to describe where this should be run from? I''ve been trying to use it as a Puppet Face from different hosts, including directly on the PuppetDB server, to no avail. I keep getting ''bad request'' or SSL cert errors. My PuppetDB is running on localhost:8080 with Nginx (with SSL) as the frontend. It''d be nice if this Face was usable from any Puppet node, or at least from the Puppet Master. On Monday, March 4, 2013 7:59:30 AM UTC-8, Erik Dalén wrote:> > 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 puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Erik Dalén
2013-Apr-04 13:08 UTC
Re: [Puppet Users] Re: Beta release of puppetdbquery module 1.0
I''ve expanded the README a bit now and release 1.0.0-pre2 which should make it a bit easier to use. It only supports queries over SSL and uses the Puppet HTTP methods for making connections. So if your Nginx uses a external CA cert you might be running into bug #15561 http://projects.puppetlabs.com/issues/15561 . In the new 1.0.0-pre2 I''ve added the ability to use other kinds of HTTP connection objects though and use a regular one in the find-nodes binary, so you can try that instead of the puppet face if you are still getting SSL errors. -- Erik Dalén On Thursday 28 March 2013 at 17:31, Stephen Price wrote:> Guys, Can you expand the README to describe where this should be run from? I''ve been trying to use it as a Puppet Face from different hosts, including directly on the PuppetDB server, to no avail. I keep getting ''bad request'' or SSL cert errors. My PuppetDB is running on localhost:8080 with Nginx (with SSL) as the frontend. It''d be nice if this Face was usable from any Puppet node, or at least from the Puppet Master. > > On Monday, March 4, 2013 7:59:30 AM UTC-8, Erik Dalén wrote: > > 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 puppet-users+unsubscribe@googlegroups.com (mailto:puppet-users+unsubscribe@googlegroups.com). > To post to this group, send email to puppet-users@googlegroups.com (mailto:puppet-users@googlegroups.com). > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Stephen Price
2013-Apr-04 15:47 UTC
Re: [Puppet Users] Re: Beta release of puppetdbquery module 1.0
Thanks for the update. I ended up having to run a modified version of the find-nodes script locally on my PuppetDB host, connecting to localhost:8080 without SSL. Any other connection (remotely to ''puppetdb'', locally to port 8081) gave me a "400: bad request". For the record, nginx is using the PuppetDB host''s key and cert that was generated on the Puppet Master during the node''s initialization (in /var/lib/puppet/ssl/...). This is definitely a great set of functions though. Makes queries a lot easier. I hope it''s eventually included as a Face in the official package. On Thursday, April 4, 2013 6:08:30 AM UTC-7, Erik Dalén wrote:> > I''ve expanded the README a bit now and release 1.0.0-pre2 which should > make it a bit easier to use. > > It only supports queries over SSL and uses the Puppet HTTP methods for > making connections. So if your Nginx uses a external CA cert you might be > running into bug #15561 http://projects.puppetlabs.com/issues/15561 . > > In the new 1.0.0-pre2 I''ve added the ability to use other kinds of HTTP > connection objects though and use a regular one in the find-nodes binary, > so you can try that instead of the puppet face if you are still getting SSL > errors. > > -- > Erik Dalén > > > On Thursday 28 March 2013 at 17:31, Stephen Price wrote: > > > Guys, Can you expand the README to describe where this should be run > from? I''ve been trying to use it as a Puppet Face from different hosts, > including directly on the PuppetDB server, to no avail. I keep getting ''bad > request'' or SSL cert errors. My PuppetDB is running on localhost:8080 with > Nginx (with SSL) as the frontend. It''d be nice if this Face was usable from > any Puppet node, or at least from the Puppet Master. > > > > On Monday, March 4, 2013 7:59:30 AM UTC-8, Erik Dalén wrote: > > > 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 puppet-users...@googlegroups.com <javascript:> (mailto: > puppet-users+unsubscribe@googlegroups.com <javascript:>). > > To post to this group, send email to puppet...@googlegroups.com<javascript:>(mailto: > puppet...@googlegroups.com <javascript:>). > > Visit this group at http://groups.google.com/group/puppet-users?hl=en. > > For more options, visit https://groups.google.com/groups/opt_out. > > > > > > > >-- 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+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.