emyl / vagrant-triggers

Allow the definition of arbitrary scripts that will run on the host before and/or after Vagrant commands.
MIT License
546 stars 35 forks source link

Cannot vagrant destroy, if I use before-destroy-trigger and VM is poweroff #64

Closed SchulteMarkus closed 8 years ago

SchulteMarkus commented 8 years ago

I am using vagrant-triggers for a before-destroy-trigger, like this

config.trigger.before :destroy do
  run_remote  "bash /vagrant/cleanup.sh"
end

When vagrant VM is not running

$ vagrant status
  Current machine states:
  default                   poweroff (virtualbox)

I cannot execute "vagrant destroy"

$ vagrant destroy
==> default: Running triggers before destroy...
==> default: Executing remote command "bash /vagrant/cleanup.sh"...
The provider for this Vagrant-managed machine is reporting that it
is not yet ready for SSH. Depending on your provider this can carry
different meanings. Make sure your machine is created and running and
try again. Additionally, check the output of `vagrant status` to verify
that the machine is in the state that you expect. If you continue to
get this error message, please view the documentation for the provider
you're using.

So for time being, the VM has to be running, if I want to destroy it. Please fix this, I don't want to to boot my VM when not necessary.

emyl commented 8 years ago

Duplicate of #55