chef-zero icon indicating copy to clipboard operation
chef-zero copied to clipboard

chef-zero query parser confused by escaped colons

Open patcon opened this issue 10 years ago • 4 comments

This query works: recipes:elkstack\:\:default This query doesn't work: recipes:elkstack\:\:default AND chef_environment:digitalocean_testing This query works: recipes:elkstack* AND chef_environment:digitalocean_testing

The error it throws is:

ERROR: #<RuntimeError: Error on token ':' at 19 of '(recipes:elkstack::default AND chef_environment:digitalocean_testing)': Unexpected binary operator>

patcon avatar Aug 14 '15 19:08 patcon

The person who created this pastebin seems to have had the same problem: http://pastie.org/pastes/8663852

patcon avatar Aug 14 '15 19:08 patcon

Messed around with the parser code, but couldn't get it working :( Ended up side-stepping the issue by simply using a roles:elkstack_server expression, but that's pretty rigid for my setup.

patcon avatar Aug 14 '15 20:08 patcon

If you use this: "recipes:elkstack\:\:default" with search, it just gets translated to "recipes:elkstack::default". (Escaping a colon has no effect.) You need to escape the "" so it is retained as part of the string.

This: "recipes:elkstack\\:\\:default" should work. Or this: 'recipes:elkstack\:\:default'

flatrocks avatar Oct 07 '15 18:10 flatrocks

Thanks! I could've sworn I tried that, but I'll give it a go when I'm next working on that cookbook, and report back :)

patcon avatar Oct 07 '15 19:10 patcon