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

Add 'halt' option to vagrant module #1233

Merged
merged 2 commits into from
Apr 11, 2018
Merged

Conversation

msheiny
Copy link
Contributor

@msheiny msheiny commented Apr 6, 2018

Added a halt option to state to shut-down a VM without deleting it.

@retr0h
Copy link
Contributor

retr0h commented Apr 6, 2018

Doesn't this functionality already exist?

@msheiny
Copy link
Contributor Author

msheiny commented Apr 6, 2018

hey @retr0h !! technically the section you highlighted already performs a halt but then immediately afterwards it performs a destroy

            if self._module.params['force_stop']:
                self._vagrant.halt(force=True)
            self._vagrant.destroy()

I just want the halt functionality without destroying the machine. Hope that makes more sense.

msheiny added a commit to freedomofpress/securedrop that referenced this pull request Apr 7, 2018
See PR ansible/molecule#1233. Before we
package up the vagrant machine into a box, we need to shutdown the
vagrant box. The built-in molecule module only had `up` or `destroy`.
*fingers-crossed* this gets in upstream and we can tear this out.
@retr0h
Copy link
Contributor

retr0h commented Apr 7, 2018

@msheiny oh yeah, I see. Can you update the module docs and add an example.

@retr0h retr0h added the v2.13 label Apr 7, 2018
def halt(self):
changed = False
cd = self._created()
if cd:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not "if self._created()"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats a good observation @berendt ... I'd like to keep my PR pretty lean though and since that paradigm is already used throughout the file. I think filing a different PR to cleanup that specific logic would be a better course of action.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msheiny Have not checked the rest of the file. if it is used everywhere else it fits.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@msheiny good catch, cleaned those up (5078930)

msheiny added a commit to freedomofpress/securedrop that referenced this pull request Apr 9, 2018
See PR ansible/molecule#1233. Before we
package up the vagrant machine into a box, we need to shutdown the
vagrant box. The built-in molecule module only had `up` or `destroy`.
*fingers-crossed* this gets in upstream and we can tear this out.
@msheiny
Copy link
Contributor Author

msheiny commented Apr 10, 2018

updated @retr0h ! 👍

@retr0h
Copy link
Contributor

retr0h commented Apr 11, 2018

Thanks @msheiny !

@retr0h retr0h merged commit 5e0c441 into ansible:master Apr 11, 2018
msheiny added a commit to freedomofpress/securedrop that referenced this pull request Apr 30, 2018
See PR ansible/molecule#1233. Before we
package up the vagrant machine into a box, we need to shutdown the
vagrant box. The built-in molecule module only had `up` or `destroy`.
*fingers-crossed* this gets in upstream and we can tear this out.
msheiny added a commit to freedomofpress/securedrop that referenced this pull request May 3, 2018
See PR ansible/molecule#1233. Before we
package up the vagrant machine into a box, we need to shutdown the
vagrant box. The built-in molecule module only had `up` or `destroy`.
*fingers-crossed* this gets in upstream and we can tear this out.
msheiny added a commit to freedomofpress/securedrop that referenced this pull request May 7, 2018
See PR ansible/molecule#1233. Before we
package up the vagrant machine into a box, we need to shutdown the
vagrant box. The built-in molecule module only had `up` or `destroy`.
*fingers-crossed* this gets in upstream and we can tear this out.
msheiny added a commit to freedomofpress/securedrop that referenced this pull request May 7, 2018
Our unique changes that were added to support suppressing NFS were
recently merged upstream in molecule 2.13:

* ansible/molecule#1235
* ansible/molecule#1233
msheiny added a commit to freedomofpress/securedrop that referenced this pull request May 7, 2018
Our unique changes that were added to support suppressing NFS were
recently merged upstream in molecule 2.13:

* ansible/molecule#1235
* ansible/molecule#1233
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