class Chef::Knife::SoftlayerGlobalIpList

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/softlayer_global_ip_list.rb, line 18
def run
  $stdout.sync = true

  if connection(:network).get_global_ip_records.body.empty?
    puts ui.color("No global ip addresses found.", :green)
  else
    puts ui.color("This operation can take several minutes.  ", :yellow)
    table_data = connection(:network).ips.map do |ip|
      {:address => ip.address, :destination => ip.destination_ip.respond_to?(:address) ? ip.destination_ip.address : 'NOT ROUTED'} if ip.global?
    end.compact
    puts Formatador.display_table(table_data, [:address, :destination])
  end
end