Method: Fission::Command::Suspend#execute

Defined in:
lib/fission/command/suspend.rb

#executeObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fission/command/suspend.rb', line 10

def execute
  super
  incorrect_arguments if @args.count != 1 && !@options.all

  vms_to_suspend.each do |vm|
    output "Suspending '#{vm.name}'"
    response = vm.suspend

    if response.successful?
      output "VM '#{vm.name}' suspended"
    else
      output_and_exit "There was an error suspending the VM.  The error was:\n#{response.message}", response.code
    end
  end
end