Class: DestroyVMCommand
- Inherits:
-
BaseCommand
- Object
- Clamp::Command
- BaseCommand
- DestroyVMCommand
- Defined in:
- bin/esx
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'bin/esx', line 79 def execute begin host = ESX::Host.connect address, user, password host.virtual_machines.each do |vm| if vm.name == vm_name print "Destroying Virtual Machine '#{vm.name}'..." vm.power_off unless vm.power_state == 'poweredOff' vm.destroy puts "Done." end end rescue Exception => e $stderr.puts "Can't connect to the host #{address}." if debug? $stderr.puts e. end exit 1 end end |