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

'vagrant destroy' always executes 'config.trigger.after' #61

Closed jeff1evesque closed 8 years ago

jeff1evesque commented 8 years ago

On the last minute, I decided I didn't want to vagrant destroy:

$ vagrant destroy
    default: Are you sure you want to destroy the 'default' VM? [y/N] n
==> default: The VM 'default' will not be destroyed, since the confirmation
==> default: was declined.
==> default: Running triggers after destroy...
==> default: Executing command "rm -Rf log"...
==> default: Command execution finished.
==> default: Executing command "rm -Rf puppet/environment/development/modules_contrib"...
==> default: Command execution finished.
==> default: Executing command "rm -Rf webroot/sites/all/themes/custom/drupal-demonstration/asset"...
==> default: Command execution finished.
==> default: Executing command "rm -Rf webroot/sites/default/files/!(README.md)"
...
==> default: Command execution finished.
==> default: Executing command "rm -f webroot/sites/default/settings.php"...
==> default: Command execution finished.
==> default: Executing command "rm -f src/default/settings.php"...
==> default: Command execution finished.

Instead, I wanted to reprovision, hoping it would save time. However, it seems to have executed config.trigger.after :destroy, regardless:

$ vagrant provision
There are errors in the configuration of this machine. Please fix
the following errors and try again:

puppet provisioner:
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib
* The configured module path doesn't exist: /path/to/drupal-demonstration/puppet/environment/development/modules_contrib

So, I was stuck to officially vagrant destroy, before vagrant up.

SchulteMarkus commented 8 years ago

This problem is similar for

config.trigger.before :destroy

Which is executed (in any case) before "Are you sure you want to destroy the 'default' VM?"

emyl commented 8 years ago

Duplicate of #40