Sha256: 60d7ec41fe14d0e563feca9742fa1aafddcd10f25d10e8ec5cc3ffe04eadbed0

Contents?: true

Size: 1.11 KB

Versions: 3

Compression:

Stored size: 1.11 KB

Contents

module VagrantPlugins

    module ProviderVirtualBox

        module Action

            class SnapshotRollback

                def initialize(app, env)
                    @app = app
                end

                def call(env)

                    # Snapshot rollback involves powering off and on the VM
                    #  so we need to find the gui state

                    boot_mode = env[:machine].provider_config.gui ? "gui" : "headless"

                    if env[:snap_name].nil?
                        env[:snap_name] = env[:machine].provider.driver.snapshot_list.last
                        env[:ui].info I18n.t("vagrant_snap.actions.vm.snapshot_rollback.rolling_back")
                    else
                        env[:ui].info(I18n.t("vagrant_snap.actions.vm.snapshot_rollback.rolling_back_named",
                            :snapshot => env[:snap_name]),
                        )
                    end

                    env[:machine].provider.driver.snapshot_rollback(boot_mode,env[:snap_name])

                    @app.call(env)

                end

            end

        end

    end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vagrant-multiprovider-snap-0.0.15 lib/vagrant-multiprovider-snap/providers/virtualbox/action/snapshot_rollback.rb
vagrant-multiprovider-snap-0.0.14 lib/vagrant-multiprovider-snap/providers/virtualbox/action/snapshot_rollback.rb
vagrant-multiprovider-snap-0.0.13 lib/vagrant-multiprovider-snap/providers/virtualbox/action/snapshot_rollback.rb