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
-
.delete_all_snapshots(machine) ⇒ Object
Delete all snapshots for the machine.
-
.delete_snapshot(machine, snapshot_name) ⇒ Object
Delete a given snapstho.
-
.snapshot_list(machine) ⇒ List<String>
List snapshots.
Class Method Details
.delete_all_snapshots(machine) ⇒ Object
Delete all snapshots for the 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
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
15 16 17 |
# File 'lib/vagrant-vmware-desktop/cap/snapshot.rb', line 15 def self.snapshot_list(machine) machine.provider.driver.snapshot_tree end |