Sha256: 28b9cfa81400abb42bf02fe4f528ad5b44f18476e3d04742fed9635731f78ad3

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

module VagrantPlugins

    module ProviderVirtualBox

        module Driver

            class Base

                def snapshot_take
                    execute("snapshot", @uuid, "take", "vagrant-snap-#{Time.now.to_i}", "--pause")
                end

                def snapshot_rollback(bootmode)
                    halt
                    sleep 2 # race condition on locked VMs otherwise?
                    execute("snapshot",  @uuid, "restore", snapshot_list.first)
                    start(bootmode)
                end

                def snapshot_list
                    info = execute("showvminfo", @uuid, "--machinereadable")
                    snapshots = []
                    info.split("\n").each do |line|
                        if line =~ /^SnapshotName="(vagrant-snap-.+?)"$/
                            snapshots << $1.to_s
                        end
                    end
                    snapshots
                end

                def has_snapshot?
                    snapshot_list.length > 0
                end

            end

        end

    end

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
vagrant-multiprovider-snap-0.0.5 lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
vagrant-multiprovider-snap-0.0.4 lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
vagrant-zz-multiprovider-snap-0.0.3 lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb
vagrant-zz-multiprovider-snap-0.0.2 lib/vagrant-multiprovider-snap/providers/virtualbox/driver/base.rb