matschaffer / knife-solo

DEPRECATED: Please consider using https://knife-zero.github.io/, ansible, or visit https://www.chef.io/ for other ideas
MIT License
786 stars 213 forks source link

Chef solo version detection fails on a Debian 9 #539

Closed zedtux closed 5 years ago

zedtux commented 5 years ago

Each time I'm trying to cook on my Debian node, I have the following error :

ERROR: RuntimeError: Couldn't find Chef >=0.10.4 on XXX.XX.XXX.XX. Please run `knife solo prepare root@XXX.XX.XXX.XX` to ensure Chef is installed and up to date.

This is due to the fact that :

  1. Debian doesn't have sudo by default, but this is workaround-able
  2. The chef-solo --version is not outputting what the Chef::Knife::SoloCook.chef_version method expects.

In the awk command, knife-solo is expecting to have an output similar to Chef: 15.0.300, while on my node the chef-solo --version command outputs Chef Infra Client: 15.0.300.

In the case I didn't nothing wrong and the command output is fine, I then suggest the to change the cmd to the following :

sudo chef-solo --version 2>/dev/null | awk '/Chef:/{print $2} /Chef Infra Client:/ {print $4}'

So that the Chef: and Chef Infra Client: are both handled and knife-solo works in both cases.

If this is fine for you, I can open a PR.

sebfie commented 5 years ago

I also need this pr!

matschaffer commented 5 years ago

As mentioned on https://github.com/matschaffer/knife-solo#deprecated I don't really intend on making any further releases of knife-solo.

You're welcome to do whatever you'd like with the code, but it seems the chef-solo flow has diverged quite a bit with the recent chef relicensing.

I haven't used chef actively in well over 5 years now so don't think I can reliably continue the project.