Sha256: d18afdbaeb4cfa3a7518cf5cba1f6abbc37a185aa14caeab2cf69dd97de918a8

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

module HashiCorp

    module VagrantVMwareworkstation

        module Driver

            class Base

                def snapshot_take(name)
                    vmrun("snapshot", "#{vmx_path}", name || "vagrant-snap-#{Time.now.to_i}")
                end

                def snapshot_delete(name)
                    vmrun("deleteSnapshot", "#{vmx_path}", name)
                end

                def snapshot_rollback(bootmode, name)
                   vmrun("revertToSnapshot", "#{vmx_path}", name || snapshot_list.last)
                   start(bootmode)
                end

                def snapshot_list
                    snapshots = []
                    vmrun("listSnapshots", "#{vmx_path}").stdout.split("\n").each do |line|
                        if line !~ /Total snapshot/
                            snapshots << line
                        end
                    end
                    snapshots
                end

                def has_snapshot?(name)
                    if name.nil?
                        return true unless snapshot_list.empty?
                    else
                        return true if snapshot_list.include? "#{name}"
                    end
                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/driver/base.rb
vagrant-multiprovider-snap-0.0.14 lib/vagrant-multiprovider-snap/providers/vmware_workstation/driver/base.rb
vagrant-multiprovider-snap-0.0.13 lib/vagrant-multiprovider-snap/providers/vmware_workstation/driver/base.rb