puppet-puppetdbquery icon indicating copy to clipboard operation
puppet-puppetdbquery copied to clipboard

Add Documentation on resource queries with empty titles

Open acidprime opened this issue 9 years ago • 2 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

[[email protected] ~]$ 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.

acidprime avatar Jan 09 '16 00:01 acidprime

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.

dalen avatar Jan 09 '16 02:01 dalen

Great thanks that worked

acidprime avatar Jan 11 '16 19:01 acidprime