dalen / puppet-puppetdbquery

Query functions for PuppetDB

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Documentation on resource queries with empty titles

acidprime opened this issue · comments

the README currently states The part in brackets is optional. You can also specify ~ before the title to do a regexp match on the title. in regards to resource query expressions.

However the following purmutations don't seem to work

[zsmith@puppetmaster2001 ~]$ sudo puppet query nodes '(@@Nagios_Service)'

[zsmith@puppetmaster2001 ~]$ sudo puppet query nodes '(@@Nagios_Service[])'
Error: 
parse error on value "]" (RBRACK)
Error: Try 'puppet help query nodes' for usage

[zsmith@puppetmaster2001 ~]$ sudo puppet query nodes '(@@Nagios_Service[~/.*/])'
Error: can not match: '/.*/])'
Error: Try 'puppet help query nodes' for usage

[zsmith@puppetmaster200 ~]$ sudo puppet query nodes '(@@Nagios_Service[~/*/])'
Error: can not match: '/*/])'
Error: Try 'puppet help query nodes' for usage

sudo puppet query nodes '(@@Nagios_Service[~.*])'
Error: 
parse error on value "." (DOT)
Error: Try 'puppet help query nodes' for usage

[zsmith@puppetmaster2001.sv2 ~]$ sudo puppet query nodes '(@@Nagios_Service[~*])'
Error: 
parse error on value "*" (ASTERISK)
Error: Try 'puppet help query nodes' for usage

I have looked through the lexer and can't figure out what the right syntax would be to query for all resources of given type without implicitly knowing their title. If this could be added to the README that would be great as the quoted text above doesn't seem to cover what I would anticipate the behavior being. I have also looked through the specs but I am missing this being tested there too.

right, so just Nagios_service worked in earlier versions. But it was tricky to get working with the new parser that handles structured facts.

However, either Nagios_service[~'.*'], Nagios_service[~''] or #resource.type=Nagios_service should work.

I'll make sure to update the docs to reflect this.

Great thanks that worked