chef/chef-zero

search not respecting the !some:condition

Closed this issue · 1 comments

This synatx makes chef-zero cry:

some_nodes = search(:node, 'roles:my_role AND !tags:excluded')

However, this syntax works:

some_nodes = search(:node, 'roles:my_role AND NOT tags:excluded')

chef-server 11.1.x and chef-client 11.16.4 work happily with the former syntax.

Hi @miketheman, the -some:condition syntax doesn't work either.

Example on a chef-zero server with 2 nodes :

knife search 'name:* AND !name:slave01' -c client.rb
0 items found

knife search 'name:* AND -name:slave01' -c client.rb
0 items found

knife search 'name:* AND NOT name:slave01' -c client.rb
1 items found

Node Name:   admin
...

The chef documentation seems to recommend - https://docs.getchef.com/essentials_search.html#operators