Skip to content

Instantly share code, notes, and snippets.

@kbarber
Last active August 29, 2015 14:00
Show Gist options
  • Save kbarber/15f043aa1be526cd9050 to your computer and use it in GitHub Desktop.
Save kbarber/15f043aa1be526cd9050 to your computer and use it in GitHub Desktop.
root@puppetdb1:~# cat query.json
["and",
["in","certname",
["extract","certname",
["select-facts",
["and",
["=","name","kernel"],
["=","value","Linux"]]]]],
["or",
["=","name","hostname"],
["=","name","processorcount"],
["=","name","memorytotal"],
["=","name","ipaddress"]]]
root@puppetdb1:~# curl -G -vv "http://localhost:8080/v3/facts" --data-urlencode [email protected]
* About to connect() to localhost port 8080 (#0)
* Trying ::1...
* connected
* Connected to localhost (::1) port 8080 (#0)
> GET /v3/facts?query=%5B%22and%22%2C%0A%20%20%5B%22in%22%2C%22certname%22%2C%0A%20%20%20%20%5B%22extract%22%2C%22certname%22%2C%0A%20%20%20%20%20%20%5B%22select-facts%22%2C%0A%20%20%20%20%20%20%20%20%5B%22and%22%2C%0A%20%20%20%20%20%20%20%20%20%20%5B%22%3D%22%2C%22name%22%2C%22kernel%22%5D%2C%0A%20%20%20%20%20%20%20%20%20%20%5B%22%3D%22%2C%22value%22%2C%22Linux%22%5D%5D%5D%5D%5D%2C%0A%20%20%5B%22or%22%2C%0A%20%20%20%20%5B%22%3D%22%2C%22name%22%2C%22hostname%22%5D%2C%0A%20%20%20%20%5B%22%3D%22%2C%22name%22%2C%22processorcount%22%5D%2C%0A%20%20%20%20%5B%22%3D%22%2C%22name%22%2C%22memorytotal%22%5D%2C%0A%20%20%20%20%5B%22%3D%22%2C%22name%22%2C%22ipaddress%22%5D%5D%5D%5D%0A HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost:8080
> Accept: */*
>
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Date: Thu, 01 May 2014 14:15:13 GMT
< Content-Type: application/json; charset=utf-8
< Content-Length: 847
< Server: Jetty(7.x.y-SNAPSHOT)
<
[ {
"certname" : "puppetdb1.vm",
"name" : "ipaddress",
"value" : "192.168.182.219"
}, {
"certname" : "puppetdb1.vm",
"name" : "hostname",
"value" : "puppetdb1"
}, {
"certname" : "puppetdb1.vm",
"name" : "processorcount",
"value" : "1"
}, {
"certname" : "pg1.vm",
"name" : "memorytotal",
"value" : "488.34 MB"
}, {
"certname" : "pg1.vm",
"name" : "ipaddress",
"value" : "192.168.182.196"
}, {
"certname" : "pg1.vm",
"name" : "hostname",
"value" : "pg1"
}, {
"certname" : "pg1.vm",
"name" : "processorcount",
"value" : "1"
}, {
"certname" : "puppetdb1.localdomain",
"name" : "ipaddress",
"value" : "192.168.182.219"
}, {
"certname" : "puppetdb1.localdomain",
"name" : "hostname",
"value" : "puppetdb1"
}, {
"certname" : "puppetdb1.localdomain",
"name" : "processorcount",
"value" : "1"
* Connection #0 to host localhost left intact
} ]* Closing connection #0
["and",
["in","certname",
["extract","certname",
["select-facts",
["and",
["=","name","kernel"],
["=","value","Linux"]]]]],
["or",
["=","name","hostname"],
["=","name","processorcount"],
["=","name","memorytotal"],
["=","name","ipaddress"]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment