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

chef.delete_node and chef.delete_client does not work (1.7.2) #5154

Closed
jfbibeau opened this issue Jan 9, 2015 · 5 comments
Closed

chef.delete_node and chef.delete_client does not work (1.7.2) #5154

jfbibeau opened this issue Jan 9, 2015 · 5 comments

Comments

@jfbibeau
Copy link

jfbibeau commented Jan 9, 2015

Looks like #5021 was fixed in Vagrant 1.7.2. However Vagrant still fails to clean up the node and client off the Chef Server.

The two lines in my Vagrantfile:

chef.delete_node = true
chef.delete_client = true

Log from trying to destroy a VM:

vagrant destroy

    latest: Are you sure you want to destroy the 'latest' VM? [y/N] y
==> latest: Forcing shutdown of VM...
==> latest: Destroying VM and associated drives...
==> latest: Pruning invalid NFS exports. Administrator privileges will be required...
==> latest: Running cleanup tasks for 'chef_client' provisioner...
==> latest: Deleting client "latest" from Chef server...
==> latest: Cleaning up the 'client' for Chef failed. The stdout and
==> latest: stderr are shown below. Vagrant will continue destroying the machine,
==> latest: so please clean up these resources manually.
==> latest: 
==> latest: stdout: Check your configuration file and ensure that your private key is readable
==> latest: 
==> latest: 
==> latest: stderr: WARNING: No knife configuration file found
==> latest: ERROR: Your private key could not be loaded from /etc/chef/client.pem
==> latest: Deleting node "latest" from Chef server...
==> latest: Cleaning up the 'node' for Chef failed. The stdout and
==> latest: stderr are shown below. Vagrant will continue destroying the machine,
==> latest: so please clean up these resources manually.
==> latest: 
==> latest: stdout: Check your configuration file and ensure that your private key is readable
==> latest: 
==> latest: 
==> latest: stderr: WARNING: No knife configuration file found
==> latest: ERROR: Your private key could not be loaded from /etc/chef/client.pem

/etc/chef/client.pem definitely does exist before the VM gets destroyed.

[vagrant@latest ~]$ ls -la /etc/chef/client.pem 
-rw-------. 1 root root 1675 Dec 22 15:49 /etc/chef/client.pem
  • Is it a permissions issue? Presumably the chef cleanup is being run as the root user?
  • Is it an order thing, is the VM being destroyed or cleaned up before running the chef cleanup, and that file no longer exists?

Maybe some more insight as to how the cleanup works can help figure out why this doesn't work. I'd really like to stop using the vagrant-butcher plugin to achieve this functionality. Thanks!

@sethvargo
Copy link
Contributor

Hi @jfbibeau,

Could you please run that command in debug mode and gist the output? How is Chef installed on your local system?

@jfbibeau
Copy link
Author

jfbibeau commented Jan 9, 2015

@sethvargo Here's the relevant part at debug level: https://gist.github.com/jfbibeau/0aea9448bda47f780828

Looking at it quickly.... Is the "knife" command being run on the vagrant VM, or is it being run on the host machine? It's looking to me like it's trying to run on the host machine?

Is it a requirement to have chef installed on the host system for this clean up to work? I was under the impression the chef provisioner only had to exist on the guest VM, and perform it's own cleanup... Otherwise anyone who runs vagrant with a chef-provisioned VM would have to install Chef also on the host machine? Am I making sense?

@sethvargo
Copy link
Contributor

@jfbibeau ah yes 😄.

You must have Chef (either the Chef Client or ChefDK) installed on your host operating system to process the cleanup tasks in the current Chef implementation.

Leaving this open to see if we can potentially move that operation onto the guest.

@jfbibeau
Copy link
Author

jfbibeau commented Jan 9, 2015

@sethvargo Thanks for the prompt reply! It would indeed be a nice enhancement, otherwise vagrant-butcher plugin does a good job of it. Cheers.

@sethvargo
Copy link
Contributor

This is actually a duplicate of #2476. Let's track that issue since it's older and has more history 😄

@ghost ghost locked and limited conversation to collaborators Apr 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants