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

Run provisioner cleanup when destroying VMs #176

Merged
1 commit merged into from
Mar 8, 2016

Conversation

Sharpie
Copy link
Contributor

@Sharpie Sharpie commented Feb 22, 2016

Vagrant v1.3.0 introduced the ability for provisioners to define cleanup tasks
that get run during VM destruction in order to clean up bits of global state.
This patch adds the ProvisionerCleanup task to the vSphere destroy action.

Vagrant v1.3.0 introduced the ability for provisioners to define cleanup tasks
that get run during VM destruction in order to clean up bits of global state.
This patch adds the ProvisionerCleanup task to the vSphere destroy action.
@Sharpie Sharpie force-pushed the enable-provisioner-cleanup branch from ac8d9a7 to 7f1fd63 Compare February 23, 2016 01:18
@mkuzmin
Copy link
Contributor

mkuzmin commented Feb 23, 2016

What exactly does it clean?

@Sharpie
Copy link
Contributor Author

Sharpie commented Feb 23, 2016

What gets cleaned is specific to the implementation of each provisioner. By default, the cleanup action is empty:

https://github.com/mitchellh/vagrant/blob/v1.8.1/lib/vagrant/plugin/v2/provisioner.rb#L45-L49

But many Vagrant plugins provide provisioners which do use cleanup actions. As an example: I use a provisioner that installs a Puppet agent on machines. The cleanup action for this provisioner cleans agent data from the Puppet master when a VM is destroyed.

@mkuzmin
Copy link
Contributor

mkuzmin commented Feb 23, 2016

Thank you for the explanation

@rylarson
Copy link
Contributor

rylarson commented Mar 3, 2016

You should probably add an assertion to action_spec to make sure that destroy calls this

@Sharpie
Copy link
Contributor Author

Sharpie commented Mar 3, 2016

@rylarson I could do that. But, since there is no conditional logic involved, it seems like re-writing the code in the tests. Put another way: I would expect the "it calls the things listed" behavior to be covered by the spec tests for Vagrant::Action::Builder.

@ghost ghost self-assigned this Mar 8, 2016
ghost pushed a commit that referenced this pull request Mar 8, 2016
Run provisioner cleanup when destroying VMs
@ghost ghost merged commit 02f43ec into nsidc:master Mar 8, 2016
@ghost
Copy link

ghost commented Mar 8, 2016

Thanks!

@Sharpie Sharpie deleted the enable-provisioner-cleanup branch February 12, 2018 14:46
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants