Sha256: e2268dc0507acafd543a43516525f5c3983b9072574657f6475b9ad56d4ea371

Contents?: true

Size: 1.33 KB

Versions: 3

Compression:

Stored size: 1.33 KB

Contents

module HashiCorp

    module VagrantVMwareworkstation

        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 ... however, the start() method in VagrantVMwarefusion.Driver.Fusion takes a
                    # bool, not a string, so setting this to "gui" or "nogui" will therefore always start
                    # in gui mode. Setting this to a bool instead

                    boot_mode = env[:machine].provider_config.gui

                    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/vmware_workstation/action/snapshot_rollback.rb
vagrant-multiprovider-snap-0.0.14 lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/snapshot_rollback.rb
vagrant-multiprovider-snap-0.0.13 lib/vagrant-multiprovider-snap/providers/vmware_workstation/action/snapshot_rollback.rb