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
|
# File 'lib/chef/knife/cs_network_list.rb', line 48
def run
connection = CloudstackClient::Connection.new(
locate_config_value(:cloudstack_url),
locate_config_value(:cloudstack_api_key),
locate_config_value(:cloudstack_secret_key)
)
network_list = [
ui.color('Name', :bold),
ui.color('Type', :bold),
ui.color('Default', :bold),
ui.color('Shared', :bold),
ui.color('Gateway', :bold),
ui.color('Netmask', :bold)
]
networks = connection.list_networks
networks.each do |n|
network_list << n['name']
network_list << n['type']
network_list << n['isdefault'].to_s
network_list << n['isshared'].to_s
network_list << (n['gateway'] || '')
network_list << (n['netmask'] || '')
end
puts ui.list(network_list, :columns_across, 6)
end
|