Module: HashiCorp::VagrantVMwareDesktop::Cap::Snapshot

Defined in:
lib/vagrant-vmware-desktop/cap/snapshot.rb

Constant Summary collapse

@@logger =
Log4r::Logger.new("hashicorp::provider::vmware::cap::snapshot")

Class Method Summary collapse

Class Method Details

.delete_all_snapshots(machine) ⇒ Object

Delete all snapshots for the machine

Parameters:

  • machine (Vagrant::Machine)
    • the current machine



22
23
24
25
26
27
28
29
30
31
# File 'lib/vagrant-vmware-desktop/cap/snapshot.rb', line 22

def self.delete_all_snapshots(machine)
  # To delete a snapshot with children of the same name, use the 
  # full path to the snapshot. eg. /clone/clone if the machine
  # has 2 snapshots called "clone"
  snapshots = machine.provider.driver.snapshot_tree
  snapshots.sort {|x, y| y.length <=> x.length}.each do |snapshot|
    @@logger.info("Deleting snapshot #{snapshot}")
    machine.provider.driver.snapshot_delete(snapshot)
  end
end

.delete_snapshot(machine, snapshot_name) ⇒ Object

Delete a given snapstho

Parameters:

  • machine (Vagrant::Machine)
    • the current machine

  • snapshot_name (String)
    • name of the snapshot to delete



37
38
39
40
# File 'lib/vagrant-vmware-desktop/cap/snapshot.rb', line 37

def self.delete_snapshot(machine, snapshot_name)
  @@logger.info("Deleting snapshot #{snapshot_name}")
  machine.provider.driver.snapshot_delete(snapshot_name)
end

.snapshot_list(machine) ⇒ List<String>

List snapshots

Parameters:

  • machine (Vagrant::Machine)
    • the current machine

Returns:

  • (List<String>)
    • snapshot names



15
16
17
# File 'lib/vagrant-vmware-desktop/cap/snapshot.rb', line 15

def self.snapshot_list(machine)
  machine.provider.driver.snapshot_tree
end