Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

knife zero converge not doing anything !? #148

Open
ohierro-verimatrix opened this issue May 11, 2021 · 9 comments
Open

knife zero converge not doing anything !? #148

ohierro-verimatrix opened this issue May 11, 2021 · 9 comments
Labels

Comments

@ohierro-verimatrix
Copy link

ohierro-verimatrix commented May 11, 2021

I'm completely new to Chef so please excuse me if I'm missing something obvious. I've installed Chef-DK and Knife-Zero on my mac, and can successfully bootstrap my test node (a macOS Big Sur VM). However when I try to test the provisioning by running knife zero converge with a sample recipe, the command just doesn't seem to do anything at all. This is what I see:

➜  ~/dev/chef-repo git:(master) knife zero converge "name:macos-intel-1-test" --override-runlist "macos::keep_awake"
WARN: Deprecation CHEF-18 from /opt/chef-workstation/embedded/lib/ruby/gems/2.7.0/gems/knife-17.0.246/lib/chef/knife.rb:493:in `run_with_pretty_exceptions'

  Starting local-mode server in deprecated socket mode

Please see https://docs.chef.io/deprecations_local_listen/ for further details and information on how to correct this problem.
➜  ~/dev/chef-repo git:(master)

The command runs for a few secs and terminates. It does seem to connect to the node by ssh very briefly before exiting, because if I intentionally break the auth settings then it errors out.

However if I pass on the same recipe to knife zero bootstrap then it does work and executes the recipe after the bootstrap is done, e.g.:

knife zero bootstrap 10.0.0.143 --node-name macos-intel-1-test -i ~/.ssh/id_rsa --sudo -y -r "macos::keep_awake"

Other than that I can run successfully other commands like knife node show macos-intel-1-test so the node querying works.

Any idea what's possibly going on?

@ohierro-verimatrix
Copy link
Author

ohierro-verimatrix commented May 17, 2021

Turns out the problem was that the chef-client command issued to the nodes by Knife-Zero is simply failing to run because it cannot be found in the $PATH. Unfortunately Knife-Zero seems to swallow the error output and so the converge command just terminates without any visible indication that something went wrong. If we simulate it ourselves directly then:

➜  ~/dev/chef-repo git:(master) ssh jenkins@10.0.0.143 chef-client
zsh:1: command not found: chef-client
➜  ~/dev/chef-repo git:(master) ssh jenkins@10.0.0.143 'echo $PATH'
/usr/bin:/bin:/usr/sbin:/sbin

Notice that the PATH is missing /usr/local/bin which is where the Chef binaries are installed. I fixed it manually via ~/.zshenv (cause I'm using zsh) but I'd guess this is something the bootstrapping process should take care of?

@stale
Copy link

stale bot commented Jul 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 21, 2021
@sawanoboly
Copy link
Member

Sorry it took me so long to answer. In such a case, writing the path of the client in knife.rb will work.

Chef::Config[:chef_client_path] = "/usr/local/bin/chef-client"

@stale stale bot removed the wontfix label Sep 30, 2021
@hendych
Copy link

hendych commented Oct 11, 2021

I don't think the case is missing chef-client from PATH. I'm able to run the binary but it also behaves like nothing happened.

WARN: Deprecation CHEF-18 from /Users/xxx/.rvm/gems/ruby-2.7.0/gems/chef-16.16.13/bin/knife:24:in `<top (required)>'

  Starting local-mode server in deprecated socket mode

Please see https://docs.chef.io/deprecations_local_listen/ for further details and information on how to correct this problem.

@sawanoboly
Copy link
Member

What version of Chef are you using on the local workstation and what version are you installing on the remote node?

For example, would the same thing happen if both were running Chef 16.x? I feel that the changes made in 17 are having an impact.

@sawanoboly
Copy link
Member

Also, some information about the execution environment of the remote node might help.
For example, the OS version, whether the platform is a public cloud instance or a Private Cloud VirtualMachine, etc.

@hendych
Copy link

hendych commented Oct 18, 2021

Confirmed that using version 17 solves this issue.

@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 17, 2022
@Nazeer2021
Copy link

I'm looking for chef training let me know if anyone interested plz reach me at Nazeer.nadaf2006@gmail.com

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants