Class: Chef::Knife::VcVappClone

Inherits:
Chef::Knife show all
Includes:
VcCommon
Defined in:
lib/chef/knife/vapp/vc_vapp_clone.rb

Instance Method Summary collapse

Methods included from VcCommon

#connection, #deprecation_msg, #generate_key, #get_password, included, #locate_config_value, #locate_org_option, #notice_msg, #out_msg, #pretty_symbol, #sort_by_key, #store_config, #store_password, #wait_task

Instance Method Details

#runObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/chef/knife/vapp/vc_vapp_clone.rb', line 52

def run
  $stdout.sync = true

  vdc_arg = @name_args.shift
  vapp_arg = @name_args.shift
  dest_vapp_name = @name_args.shift

  org_name = locate_org_option
  deploy_clone = locate_config_value(:vm_deploy_clone).to_s
  poweron_clone = locate_config_value(:vm_poweron_clone).to_s
  delete_source = locate_config_value(:vm_delete_source).to_s

  connection.

  org = connection.get_organization_by_name org_name
  vdc = connection.get_vdc_by_name org, vdc_arg
  vapp = connection.get_vapp_by_name org, vdc[:name], vapp_arg

  result = connection.clone_vapp vdc[:id], vapp[:id], dest_vapp_name, deploy_clone, poweron_clone, delete_source

  ui.msg "Cloning vApp..."
  wait_task(connection, result[:task_id])
  ui.msg "vApp cloned with ID: #{ui.color(result[:vapp_id], :cyan)}"

  connection.logout
end