81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# File 'bin/esx', line 81
def execute
begin
host = ESX::Host.connect address, user, password, true, {:free_license=>free_license?}
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.message
end
exit 1
end
end
|