Class: Chef::Knife::VcVappShow
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::VcVappShow
- Includes:
- VcCommon, VcVappCommon
- Defined in:
- lib/chef/knife/vapp/vc_vapp_show.rb
Instance Method Summary collapse
Methods included from VcVappCommon
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
#run ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 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 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/chef/knife/vapp/vc_vapp_show.rb', line 27 def run $stdout.sync = true vapp_arg = @name_args.shift connection.login vapp = get_vapp(vapp_arg) connection.logout out_msg("Name", vapp[:name]) out_msg("Description", vapp[:description]) out_msg("Status", vapp[:status]) out_msg("IP", vapp[:ip]) ui.msg("#{ui.color('Networks', :cyan)}") vapp[:networks].each do |network| ui.msg ui.color(network[:name], :bold) list = [ ui.color(' ', :bold), ui.color('Gateway', :bold), ui.color('Netmask', :bold), ui.color('Fence Mode', :bold), ui.color('Parent Network', :bold), ui.color('Retain Network', :bold) ] list << " " list << (network[:scope][:gateway] || '') list << (network[:scope][:netmask] || '') list << (network[:scope][:fence_mode] || '') list << (network[:scope][:parent_network] || '') list << (network[:scope][:retain_network] || '') ui.msg ui.list(list, :uneven_columns_across, 6) end if vapp[:vapp_snapshot] out_msg("Snapshot", vapp[:vapp_snapshot][:creation_date]) end ui.msg("#{ui.color('VMs', :cyan)}") list = [ ui.color('Name', :bold), ui.color('Status', :bold), ui.color('IPs', :bold), ui.color('ID', :bold), ui.color('Scoped ID', :bold) ] vapp[:vms_hash].each do |k, v| list << (k || '') list << (v[:status] || '') list << (v[:addresses].join(', ') || '<no ip>') list << (v[:id] || '') list << (v[:vapp_scoped_local_id] || '') end ui.msg ui.list(list, :uneven_columns_across, 5) end |