Subquery, regular query difference?

32 views
Skip to first unread message

ak0ska

unread,
Jan 20, 2014, 10:17:39 AM1/20/14
to puppet...@googlegroups.com
Hello,

We wanted to created a query, which would check the hostgroup fact of machines that apply a certain type of resource declared in a certain manifest file. We wanted to use the 'select-resources' subquery as follows:

curl -G -H "Accept: application/json" localhost:8080/v3/facts --data-urlencode 'query=["and",["=","name","hostgroup"], ["in","certname",["extract","certname", ["select-resources", ["and",["=", "type", "Class"],["=","file","/path/to/mymanifest.pp"]]]]]]'

This returns an error: "file is not a queryable object for resources".
According to the documentation, 'select-resources' takes any arguments valid for /v3/resources endpoint.

If we try the arguments of 'select-resources' directly to the resources endpoint, we get valid results:

curl -G -H "Accept: application/json" localhost:8080/v3/resources --data-urlencode 'query=["and",["=", "type", "Class"],["=","file","/path/to/mymanifest.pp"]]'

lists all 'Class' type resources (and properties)  declared in mymanifest.pp.

If we try and query the "title" property, instead of the "file" property it works fine. Did we miss something?

ak0ska

unread,
Jan 20, 2014, 10:19:59 AM1/20/14
to puppet...@googlegroups.com
Forgot to mention that it's a PuppetDB issue. ;)

jcbollinger

unread,
Jan 21, 2014, 9:49:58 AM1/21/14
to puppet...@googlegroups.com


I read the docs the same way you do, and on that basis I see nothing wrong with your query.  I would file a ticket.


John

Ken Barber

unread,
Jan 21, 2014, 12:37:19 PM1/21/14
to Puppet Users
Yeah, that looks like a bug Akos. Can you file it?
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/puppet-users/3d02804b-7306-4671-a823-c40263448130%40googlegroups.com.
>
> For more options, visit https://groups.google.com/groups/opt_out.

ak0ska

unread,
Jan 22, 2014, 4:50:09 AM1/22/14
to puppet...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages