Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Mike Sharpton
I was messing around in psql to see if I could figure out the table structure and just query without the API wrapper, I couldn't before you replied. Price is right losing horn. On Friday, June 3, 2016 at 1:37:59 PM UTC-5, Mike Sharpton wrote: > > Doh! Quotes matter, didn't think of it. That a

Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Mike Sharpton
Doh! Quotes matter, didn't think of it. That appears to work, I grepped and piped and have my list. Thanks very much again, you have saved me work twice now. Mike On Friday, June 3, 2016 at 12:43:17 PM UTC-5, Wyatt Alt wrote: > > Mike, > > Where I was going with that is you might get resul

Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Mike Sharpton
Yep, the value of my fact is a string. I will keep googling around to see what I can find. Thanks, Mike On Friday, June 3, 2016 at 11:31:28 AM UTC-5, Wyatt Alt wrote: > > Hey Mike, > > I think operatingsystemmajrelease might be a string instead of an int, > based on https://tickets.puppetlab

Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Wyatt Alt
Mike, Where I was going with that is you might get results with curl -X GET http://localhost:8080/pdb/query/v4/nodes -d 'query=["and", ["=", ["fact", "operatingsystemmajrelease"], "7"], ["=", ["fact", "facta"], "true"]]' or curl -X GET http://localhost:8080/pdb/query/v4/nodes -d 'query=["and",

Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Wyatt Alt
Hey Mike, I think operatingsystemmajrelease might be a string instead of an int, based on https://tickets.puppetlabs.com/browse/FACT-962. You also might verify that facta is valued with a real boolean instead of a stringified bool (the reference to casing made me wonder.) Wyatt -- You recei

Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Mike Sharpton
Wyatt, Thanks for your reply. I changed out my url and facta to my fact name, nothing is returned except this. [ ] To ensure it wasn't my fact that was messing this up, I tried another standard fact is_pe. The value should be uppercase "False" but this returns a 500 when run that post/GET.

Re: [Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Wyatt Alt
Hey Mike, I'm thinking you want something like this: curl -X GET http://localhost:8080/pdb/query/v4/nodes -d 'query=["and", ["=", ["fact", "operatingsystemmajrelease"], 7], ["=", ["fact", "facta"], true]]' Wyatt On Fri, Jun 3, 2016 at 6:40 AM, Mike Sharpton wrote: > Hey all, > > I am trying

[Puppet Users] PuppetDB Query based on facts

2016-06-03 Thread Mike Sharpton
Hey all, I am trying to do what should be a simple thing. I need to query PuppetDB to gather a list of machines based on arbitrary facta being equal to true and the operatingsystemmajrelease fact being 7. I have searched around and found a few examples, but can't get them to work properly. I