I want to use a filter with logical operators comparing variables in attrs.vars of Hosts/Services e.g.
curl -k -s -u username:password -H 'Accept: application/json' -X GET 'https://1.2.3.4:5665/v1/objects/hosts' -d '{ "type": "Host", "filter": "host.vars.reboot>0" }'
response: { "error": 404.0, "status": "No objects found." }
When I use equals host with 1 reboot are found:
curl -k -s -u username:password -H 'Accept: application/json' -X GET 'https://1.2.3.4:5665/v1/objects/hosts' -d '{ "type": "Host", "filter": "host.vars.reboot==1" }'
response: [...some hosts where vars.reboot == 0...]
but when I filter for a default variable like state it does function
curl -k -s -u username:password -H 'Accept: application/json' -X GET 'https://1.2.3.4:5665/v1/objects/hosts' -d '{ "type": "Host", "filter": "host.state>0" }'
response: [...some hosts...]
My current workaround:
curl -k -s -u username:password -H 'Accept: application/json' -X GET 'https://1.2.3.4:5665/v1/objects/hosts' -d '{ "type": "Host", "filter":"host.vars.reboot!=0 && host.vars.reboot!=null"}'
response: [...correctly filtered hosts ...]