How do I use the not operator in curl PQL queries?

asked 2017-04-03 09:00:16 -0600

I am trying to query for nodes that has a numerical fact not equal to a value, using curl thus:

I'm just showing the query part here:

query=nodes[certname] { deactivated is null and expired is null and facts { name="clustergroup" and ! value=1 }}'

Testing for equality, without the "!" it works fine, but this does not return the expect list of nodes that has other numerical values for clustergroup than 1. It returns nothing.

If I go to the Puppet Enterprise GUI under Configuration/Filter by facts and choose "clustergroup != 1" it works like a charm. But as I understand it you can not use "!=" in curl queries? Or am I wrong?

So, how do you use the not operator "!" in curl PQL queries? Could someone give me an example of how to use this for strings or in this case numerical facts?

edit retag flag offensive close merge delete

Comments

I tried a variant of this that actually worked: query=nodes[certname] { deactivated is null and expired is null and ! facts { name="clustergroup" and value=1 }}' That is, I put the not operator "!" in front of the whole "facts {}" condition statement.

goranbr gravatar imagegoranbr ( 2017-04-04 03:36:46 -0600 )edit