Method: Fission::VM#snapshots

Defined in:
lib/fission/vm.rb

#snapshotsObject



33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/fission/vm.rb', line 33

def snapshots
  command = "#{Fission.config.attributes['vmrun_cmd']} listSnapshots #{conf_file.gsub ' ', '\ '} 2>&1"
  output = `#{command}`

  if $?.exitstatus == 0
    snaps = output.split("\n").select { |s| !s.include? 'Total snapshots:' }
    snaps.map { |s| s.strip }
  else
    Fission.ui.output "There was an error getting the list of snapshots."
    Fission.ui.output_and_exit "The error was:\n#{output}", 1
  end
end