Class: Vixen::CommandLine::Stop

Inherits:
Base
  • Object
show all
Defined in:
lib/vixen/command_line/stop.rb

Instance Attribute Summary

Attributes inherited from Base

#context, #start

Instance Method Summary collapse

Methods inherited from Base

#elapsed_time, #host, #initialize, #new_line_after, #print, #puts, #vms

Constructor Details

This class inherits a constructor from Vixen::CommandLine::Base

Instance Method Details

#executeObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/vixen/command_line/stop.rb', line 4

def execute
  count = 0

  vms.each do |vm|
    if vm.powered_on?
      new_line_after do
        vm.power_off do |*args|
          print "Powering off #{vm.name}"
        end
      end
      count += 1
    end
  end
  puts "Powered off #{count} machines"
end