Chef: does knife search ordering work?

Created on 4 Jan 2016  路  6Comments  路  Source: chef/chef

I've tried to query a sorted list of nodes from chef but can't get it to work. I've tried multiple syntaxes but couldn't figure out a working order expression. I'm not sure if ordering is not working at all, or if I was just unable to find the correct syntax. I'm using chef-client 12.5.1 with chef server 12.5.1-1.

The most intuitive syntax i tried was:

# knife search node os:linux -o name -i
53 items found

act.<anonymized>.at
btv.<anonymized>.at
mis.<anonymized>.at
obk.<anonymized>.at
obk.<anonymized>.at
bks.<anonymized>.at
lnz.<anonymized>.at
obk.<anonymized>.at
nwv.<anonymized>.at
obk.<anonymized>.at
...

Can you help me with the correct syntax and/or add an example to https://docs.chef.io/knife_search.html?

Thanks in advance,
Lothar

Most helpful comment

Ah, that's a good reason it's not supported. Let's just get it out of the docs and it'll be good!

All 6 comments

knife search works fine, but sorting search data has been deprecated for a long time. You need to sort it on your side.

May I suggest the removal of the option from knife search and the documentation then? An option without function doesn't make any sense to me.

I'm +1 on removing the option or at least adding a warning if we are worried about breaking people's existing scripts.

How is this not fixed yet? And how is this marked as fixed? As of chef version 12.18.31, this is still in the documentation, both in man and on your website, as a feature, yet it's not there.
Also this would be a really useful feature. I wish it wasn't removed.

@glajchs Unfortunately implementing configurable ordering is difficult in a paginated API. It wasn't removed so much as it never worked in the first place (back in the Ruby Chef Server days long ago).

Ah, that's a good reason it's not supported. Let's just get it out of the docs and it'll be good!

Was this page helpful?
0 / 5 - 0 ratings