Class: Chef::Knife::OraclevmVmDelete

Inherits:
BaseOraclevmCommand show all
Defined in:
lib/chef/knife/oraclevm_vm_delete.rb

Overview

delete a VM

Instance Method Summary collapse

Methods inherited from BaseOraclevmCommand

#delete_vm, #fatal_exit, #get_cli_connection, get_common_options, #get_config, #get_host, #get_password, #get_vm, #list_serverpool, #list_vm, #restart_vm, #resume_vm, #show_vm_status, #start_vm, #stop_vm, #suspend_vm, #tcp_test_port

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/chef/knife/oraclevm_vm_delete.rb', line 19

def run

  $stdout.sync = true

  vmname = @name_args[0]
  if vmname.nil?
    show_usage
    ui.fatal("You must specify a virtual machine name")
    exit 1
  end
  current=show_vm_status(vmname)
  Chef::Log.debug("Status = #{current[:status]}.  Time = #{current[:time]}. VM Status = #{current[:vmstatus]}.")
 
  if current[:status]=="Success"
     dstatus=delete_vm(vmname)
     if dstatus[:status] == "Success"
        puts "#{dstatus[:status]}"
     else
        puts "Failed with #{dstatus[:errormsg]}"
     end
  else
    puts "Call to OVM CLI Failed with #{current[:errormsg]}"
  end
end