Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

query declared classes of a specific node #86

Open
unki opened this issue Feb 23, 2016 · 1 comment
Open

query declared classes of a specific node #86

unki opened this issue Feb 23, 2016 · 1 comment

Comments

@unki
Copy link
Contributor

unki commented Feb 23, 2016

Previously I was using query_resource() to retrieve all declared classes on a specific node. This was done by:

query_resources("certname=somehost", "Class")

Since I updated to PuppetDB 3.2 and switched to puppetdbquery 2.1.1 the above query does not fail, but retrieves nothing.

I'm not sure how I shall rework that query. I tried already:

query_resource("certname=somehost", "type[class]")
query_resource("certname=somehost", "type[class]{name~'.*'}")

They succeed but also returned no result. Querying PuppetDB directly I would use this query string to retrieve all classes:

curl -X GET http://localhost:8080/pdb/query/v4/resources --data-urlencode 'query=["and", ["=","certname","somehost"], ["=","type","Class"]]'

But I have no clue how I get it work with puppetdbquery.

@unki unki changed the title query allow classes from a node query declared classes of a specific node Feb 23, 2016
@unki
Copy link
Contributor Author

unki commented Mar 1, 2016

if I pass around parser and extend query_resources.rb around line 51 by...

if resquery != 'Class'
resquery = parser.parse resquery, :none if resquery and resquery.is_a? String
else
resquery = ["=","type","Class"]
end

... I'm able to restore the previous behaviour

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant