c10l / vagrant-butcher

Delete Chef client and node when destroying Vagrant VM
MIT License
124 stars 12 forks source link

Errno::EPERM on vagrant destroy #36

Closed scalp42 closed 10 years ago

scalp42 commented 10 years ago

I'm seeing a new issue on vagrant destroy (using master/ 237f8e3b5eacfd361238619f259920acb115bf8e):

    [Butcher] Chef node 'zs-common-scalp-vagrant-vbox' successfully butchered from the server...
    [Butcher] Chef client 'zs-common-scalp-vagrant-vbox' successfully butchered from the server...
    /Users/scalp/.vagrant.d/gems/gems/vagrant-butcher-2.1.1/lib/vagrant-butcher/helpers/key_files.rb:81:in `delete': Operation not permitted - /Users/scalp/audax/cookbooks/zs-common/.vagrant/butcher/zs1-client.pem (Errno::EPERM)
        from /Users/scalp/.vagrant.d/gems/gems/vagrant-butcher-2.1.1/lib/vagrant-butcher/helpers/key_files.rb:81:in `cleanup_cache_dir'
        from /Users/scalp/.vagrant.d/gems/gems/vagrant-butcher-2.1.1/lib/vagrant-butcher/helpers/connection.rb:50:in `cleanup'
        from /Users/scalp/.vagrant.d/gems/gems/vagrant-butcher-2.1.1/lib/vagrant-butcher/action/cleanup.rb:14:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builtin/env_set.rb:19:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builtin/config_validate.rb:25:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builder.rb:116:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/runner.rb:69:in `block in run'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/util/busy.rb:19:in `busy'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/runner.rb:69:in `run'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builtin/call.rb:51:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:95:in `block in finalize_action'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builder.rb:116:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/runner.rb:69:in `block in run'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/util/busy.rb:19:in `busy'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/runner.rb:69:in `run'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builtin/call.rb:51:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/providers/virtualbox/action/check_virtualbox.rb:17:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/warden.rb:34:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/builder.rb:116:in `call'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/runner.rb:69:in `block in run'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/util/busy.rb:19:in `busy'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/action/runner.rb:69:in `run'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/machine.rb:147:in `action'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/commands/destroy/command.rb:28:in `block in execute'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/plugin/v2/command.rb:193:in `block in with_target_vms'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/plugin/v2/command.rb:191:in `each'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/plugin/v2/command.rb:191:in `with_target_vms'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/plugins/commands/destroy/command.rb:27:in `execute'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/cli.rb:38:in `execute'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/lib/vagrant/environment.rb:484:in `cli'
        from /Applications/Vagrant/embedded/gems/gems/vagrant-1.4.0/bin/vagrant:127:in `<top (required)>'
        from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `load'
        from /Applications/Vagrant/bin/../embedded/gems/bin/vagrant:23:in `<main>'

Tree hierarchy:

$> pwd ; tree                                                                                                                                                     

/Users/scalp/audax/cookbooks/zs-common/.vagrant/butcher
.
└── zs1-client.pem
    └── client.pem

1 directory, 1 file

To be sure, I ran chmod -R 777 on .vagrant/butcher.

Not sure how this happened, but still cant delete the key if you have any ideas ?

(I'm starting to feel guilty)

c10l commented 10 years ago

I see... 237f8e3 does fix that. I'm pushing a hotfix.

c10l commented 10 years ago

Fixed on 2.1.2.

Make sure to rm -rf .vagrant/butcher before starting a new VM!