Class: Chef::Knife::RackspaceNetworkList

Inherits:
Chef::Knife show all
Includes:
RackspaceBase
Defined in:
lib/chef/knife/rackspace_network_list.rb

Instance Method Summary collapse

Methods included from RackspaceBase

#auth_endpoint, #connection, #connection_params, included, #ip_address, #locate_config_value, #msg_pair, #public_dns_name, #region_warning_for_v1

Methods inherited from Chef::Knife

#get_networks, #get_node_name

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/chef/knife/rackspace_network_list.rb', line 11

def run
  if version_one?
    ui.error "Networks are not supported in v1"
    exit 1
  else
    networks_list = [
      ui.color("Label", :bold),
      ui.color("CIDR", :bold),
      ui.color("ID", :bold),
    ]
  end
  connection.networks.sort_by(&:id).each do |network|
    networks_list << network.label
    networks_list << network.cidr
    networks_list << network.id.to_s
  end
  puts ui.list(networks_list, :uneven_columns_across, 3)
end