Class: Chef::Knife::AzureServerDescribe
- Inherits:
-
Chef::Knife
- Object
- Chef::Knife
- Chef::Knife::AzureServerDescribe
- Includes:
- AzureBase
- Defined in:
- lib/chef/knife/azure_server_describe.rb
Instance Method Summary collapse
Methods included from AzureBase
#connection, included, #locate_config_value, #msg_pair, #validate!
Instance Method Details
#run ⇒ Object
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 |
# File 'lib/chef/knife/azure_server_describe.rb', line 31 def run $stdout.sync = true validate! @name_args.each do |name| role = connection.roles.find name puts '' if (role) details = Array.new details << ui.color('Role name', :bold, :blue) details << role.name details << ui.color('Status', :bold, :blue) details << role.status details << ui.color('Size', :bold, :blue) details << role.size details << ui.color('Hosted service name', :bold, :blue) details << role.hostedservicename details << ui.color('Deployment name', :bold, :blue) details << role.deployname details << ui.color('Host name', :bold, :blue) details << role.hostname details << ui.color('SSH', :bold, :blue) details << role.sshipaddress + ':' + role.sshport puts ui.list(details, :columns_across, 2) if role.tcpports.length > 0 || role.udpports.length > 0 details.clear details << ui.color('Ports open', :bold, :blue) details << ui.color('Local port', :bold, :blue) details << ui.color('IP', :bold, :blue) details << ui.color('Public port', :bold, :blue) if role.tcpports.length > 0 role.tcpports.each do |port| details << 'tcp' details << port['LocalPort'] details << port['Vip'] details << port['PublicPort'] end end if role.udpports.length > 0 role.udpports.each do |port| details << 'udp' details << port['LocalPort'] details << port['Vip'] details << port['PublicPort'] end end puts ui.list(details, :columns_across, 4) end end end end |