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 missing features to snapshot restore/pop #6879

Merged
merged 3 commits into from
Mar 4, 2016

Conversation

jtopper
Copy link
Contributor

@jtopper jtopper commented Jan 15, 2016

In our test environments, it's good to be able to roll back to the same,
anonymous, snapshot repeatedly. This patch adds a --no-delete option
to the snapshot pop command allowing this.

This makes the new core snapshot behaviour more consistent with what we
were doing with vagrant-multiprovider-snap which I intend to deprecate eventually.

In our test environments, it's good to be able to roll back to the same,
anonymous, snapshot repeatedly.  This patch adds a `--no-delete` option
to the `snapshot pop` command allowing this.

This makes the new core snapshot behaviour more consistent with what we
were doing with vagrant-multiprovider-snap
(https://github.com/scalefactory/vagrant-multiprovider-snap)
@jtopper jtopper changed the title Add --no-delete to 'snapshot pop' command Add missing features to snapshot restore/pop Jan 16, 2016
@jtopper
Copy link
Contributor Author

jtopper commented Jan 16, 2016

I've also added a patch to allow the provisioning flags (available with the up and reload commands) to be passed to the snapshot restore and snapshot pop commands, so that it is not necessary to run the provisioner on rollback.

@ferventcoder
Copy link

The default snapshot rollback behavior should be not to run any provisioning - it should be an explicit opt in with --provision. Thoughts?

We talked about this on the other issue and I agree that it would require a semver boundary to adjust the default behavior, even if it wasn't correct (since snapshot was not considered a preview).

snapshot_name = "push_#{Time.now.to_i}_#{rand(10000)}"

# Save the snapshot. This will raise an exception if it fails.
machine.action(:snapshot_save, snapshot_name: snapshot_name)
end

def pop(machine)
def pop(machine,opts={})
Copy link
Contributor

Choose a reason for hiding this comment

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

Style nit - comma space on all these args.

@phinze
Copy link
Contributor

phinze commented Mar 4, 2016

LGTM - thanks @jtopper!

phinze added a commit that referenced this pull request Mar 4, 2016
Add missing features to snapshot restore/pop
@phinze phinze merged commit 32519b2 into hashicorp:master Mar 4, 2016
jtopper added a commit to jtopper/vagrant that referenced this pull request Mar 6, 2016
sethvargo added a commit that referenced this pull request Mar 7, 2016
gitebra pushed a commit to gitebra/vagrant that referenced this pull request Mar 8, 2016
* commit '1f88a9737369eda3dede0d3aeb30928adf82a9f7':
  website: catch more atlas.hashicorp.com and fix enterprise spelling
  Update CHANGELOG
  website: add a page to send folks to get to a signup link for atlas
  Corrected binary logic description.
  Restart network after reconfiguration
  fix
  Update CHANGELOG
  Update website docs for hashicorp#6879
  Fixed centos 7 networks if using more than 3 ethernet adapters.
  fixes hashicorp#7098 only specifying Hyper-V generation if the parameter is supported
  Update CHANGELOG.md
  Fix up style nit.
  Update docs
  Update CHANGELOG
  Support provisioning flags on snapshot rollback
  Add --no-delete to 'snapshot pop' command
@rfletcher
Copy link

In case anyone else ends up here the same way I did: It looks like updates to the docs have been released prematurely.

As I write this they mention the new --[no-]provision options for these snapshot subcommands, but 1.8.1 is the current release, and it does not appear to support those options:

$ vagrant --version
Vagrant 1.8.1
$ vagrant snapshot restore --help
Usage: vagrant snapshot restore [options] [vm-name] <name>

Restore a snapshot taken previously with snapshot save.
    -h, --help                       Print this help

Happy to find that --no-provision is coming though!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants