knife-cloudstack 0.0.15 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. data/CHANGES.rdoc +15 -0
  2. data/README.rdoc +18 -0
  3. data/lib/chef/knife/cs_aag_list.rb +58 -0
  4. data/lib/chef/knife/cs_account_list.rb +32 -75
  5. data/lib/chef/knife/cs_base.rb +2 -5
  6. data/lib/chef/knife/cs_baselist.rb +37 -7
  7. data/lib/chef/knife/cs_cluster_list.rb +18 -51
  8. data/lib/chef/knife/cs_config_list.rb +14 -43
  9. data/lib/chef/knife/cs_disk_list.rb +16 -47
  10. data/lib/chef/knife/cs_domain_list.rb +15 -45
  11. data/lib/chef/knife/cs_firewallrule_list.rb +19 -52
  12. data/lib/chef/knife/cs_host_list.rb +19 -53
  13. data/lib/chef/knife/cs_iso_list.rb +30 -44
  14. data/lib/chef/knife/cs_keypair_list.rb +12 -51
  15. data/lib/chef/knife/cs_network_list.rb +20 -51
  16. data/lib/chef/knife/cs_oscategory_list.rb +12 -40
  17. data/lib/chef/knife/cs_ostype_list.rb +15 -43
  18. data/lib/chef/knife/cs_pod_list.rb +18 -51
  19. data/lib/chef/knife/cs_project_list.rb +16 -45
  20. data/lib/chef/knife/cs_publicip_list.rb +16 -49
  21. data/lib/chef/knife/cs_router_list.rb +16 -46
  22. data/lib/chef/knife/cs_securitygroup_list.rb +14 -89
  23. data/lib/chef/knife/cs_server_add_nic.rb +109 -0
  24. data/lib/chef/knife/cs_server_create.rb +25 -5
  25. data/lib/chef/knife/cs_server_list.rb +35 -62
  26. data/lib/chef/knife/cs_server_remove_nic.rb +101 -0
  27. data/lib/chef/knife/cs_service_list.rb +19 -59
  28. data/lib/chef/knife/cs_stack_create.rb +2 -0
  29. data/lib/chef/knife/cs_template_list.rb +26 -55
  30. data/lib/chef/knife/cs_template_register.rb +4 -4
  31. data/lib/chef/knife/cs_user_list.rb +19 -50
  32. data/lib/chef/knife/cs_volume_list.rb +17 -46
  33. data/lib/chef/knife/cs_zone_list.rb +13 -57
  34. data/lib/knife-cloudstack/connection.rb +60 -9
  35. metadata +5 -3
@@ -16,20 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cs_base'
19
+ require 'chef/knife'
20
20
  require 'chef/knife/cs_baselist'
21
21
 
22
22
  module KnifeCloudstack
23
23
  class CsOstypeList < Chef::Knife
24
24
 
25
- include Chef::Knife::KnifeCloudstackBase
26
25
  include Chef::Knife::KnifeCloudstackBaseList
27
-
28
- deps do
29
- require 'knife-cloudstack/connection'
30
- Chef::Knife.load_deps
31
- end
32
-
26
+
33
27
  banner "knife cs ostype list (options)"
34
28
 
35
29
  option :keyword,
@@ -39,41 +33,19 @@ module KnifeCloudstack
39
33
  def run
40
34
  validate_base_options
41
35
 
42
- if locate_config_value(:fields)
43
- object_list = []
44
- locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
45
- else
46
- object_list = [
47
- ui.color('ID', :bold),
48
- ui.color('Description', :bold),
49
- ui.color('OS Categorie ID', :bold)
50
- ]
51
- end
52
-
53
- columns = object_list.count
54
- object_list = [] if locate_config_value(:noheader)
55
-
56
- connection_result = connection.list_object(
57
- "listOsTypes",
58
- "ostype",
59
- locate_config_value(:filter),
60
- false,
61
- locate_config_value(:keyword)
62
- )
63
-
64
- output_format(connection_result)
65
-
66
- connection_result.each do |r|
67
- if locate_config_value(:fields)
68
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
69
- else
70
- object_list << r['id'].to_s
71
- object_list << r['description'].to_s
72
- object_list << r['oscategoryid'].to_s
73
- end
74
- end
75
- puts ui.list(object_list, :uneven_columns_across, columns)
76
- list_object_fields(connection_result) if locate_config_value(:fieldlist)
36
+ columns = [
37
+ 'Description :description',
38
+ 'ID :id',
39
+ 'OS Categorie ID :oscategoryid'
40
+ ]
41
+
42
+ params = { 'command' => "listOsTypes" }
43
+ params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
44
+ params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
45
+ params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
46
+
47
+ result = connection.list_object(params, "ostype")
48
+ list_object(columns, result)
77
49
  end
78
50
 
79
51
  end
@@ -16,20 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cs_base'
19
+ require 'chef/knife'
20
20
  require 'chef/knife/cs_baselist'
21
21
 
22
22
  module KnifeCloudstack
23
23
  class CsPodList < Chef::Knife
24
24
 
25
- include Chef::Knife::KnifeCloudstackBase
26
25
  include Chef::Knife::KnifeCloudstackBaseList
27
26
 
28
- deps do
29
- require 'knife-cloudstack/connection'
30
- Chef::Knife.load_deps
31
- end
32
-
33
27
  banner "knife cs pod list (options)"
34
28
 
35
29
  option :name,
@@ -43,50 +37,23 @@ module KnifeCloudstack
43
37
  def run
44
38
  validate_base_options
45
39
 
46
- if locate_config_value(:fields)
47
- object_list = []
48
- locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
49
- else
50
- object_list = [
51
- ui.color('Name', :bold),
52
- ui.color('Zone', :bold),
53
- ui.color('Gateway', :bold),
54
- ui.color('Netmask', :bold),
55
- ui.color('Start IP', :bold),
56
- ui.color('End IP', :bold),
57
- ui.color('AllocationState', :bold)
58
- ]
59
- end
60
-
61
- columns = object_list.count
62
- object_list = [] if locate_config_value(:noheader)
63
-
64
- connection_result = connection.list_object(
65
- "listPods",
66
- "pod",
67
- locate_config_value(:filter),
68
- false,
69
- locate_config_value(:keyword),
70
- locate_config_value(:name)
71
- )
72
-
73
- output_format(connection_result)
74
-
75
- connection_result.each do |r|
76
- if locate_config_value(:fields)
77
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
78
- else
79
- object_list << r['name'].to_s
80
- object_list << r['zonename'].to_s
81
- object_list << r['gateway'].to_s
82
- object_list << r['netmask'].to_s
83
- object_list << r['startip'].to_s
84
- object_list << r['endip'].to_s
85
- object_list << r['allocationstate'].to_s
86
- end
87
- end
88
- puts ui.list(object_list, :uneven_columns_across, columns)
89
- list_object_fields(connection_result) if locate_config_value(:fieldlist)
40
+ columns = [
41
+ 'Name :name',
42
+ 'Zone :zonename',
43
+ 'Gateway :gateway',
44
+ 'Netmask :netmask',
45
+ 'Start IP :startip',
46
+ 'End IP :endip',
47
+ 'AllocationState :allocationstate'
48
+ ]
49
+
50
+ params = { 'command' => "listPods" }
51
+ params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
52
+ params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
53
+ params['name'] = locate_config_value(:name) if locate_config_value(:name)
54
+
55
+ result = connection.list_object(params, "pod")
56
+ list_object(columns, result)
90
57
  end
91
58
 
92
59
  end
@@ -16,20 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cs_base'
19
+ require 'chef/knife'
20
20
  require 'chef/knife/cs_baselist'
21
21
 
22
22
  module KnifeCloudstack
23
23
  class CsProjectList < Chef::Knife
24
24
 
25
- include Chef::Knife::KnifeCloudstackBase
26
25
  include Chef::Knife::KnifeCloudstackBaseList
27
26
 
28
- deps do
29
- require 'knife-cloudstack/connection'
30
- Chef::Knife.load_deps
31
- end
32
-
33
27
  banner "knife cs project list (options)"
34
28
 
35
29
  option :listall,
@@ -48,44 +42,21 @@ module KnifeCloudstack
48
42
  def run
49
43
  validate_base_options
50
44
 
51
- if locate_config_value(:fields)
52
- object_list = []
53
- locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
54
- else
55
- object_list = [
56
- ui.color('Name', :bold),
57
- ui.color('Account', :bold),
58
- ui.color('Domain', :bold),
59
- ui.color('State', :bold),
60
- ]
61
- end
62
-
63
- columns = object_list.count
64
- object_list = [] if locate_config_value(:noheader)
65
-
66
- connection_result = connection.list_object(
67
- "listProjects",
68
- "project",
69
- locate_config_value(:filter),
70
- locate_config_value(:listall),
71
- locate_config_value(:keyword),
72
- locate_config_value(:name)
73
- )
74
-
75
- output_format(connection_result)
76
-
77
- connection_result.each do |r|
78
- if locate_config_value(:fields)
79
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
80
- else
81
- object_list << r['name'].to_s
82
- object_list << r['account'].to_s
83
- object_list << r['domain'].to_s
84
- object_list << r['state'].to_s
85
- end
86
- end
87
- puts ui.list(object_list, :uneven_columns_across, columns)
88
- list_object_fields(connection_result) if locate_config_value(:fieldlist)
45
+ columns = [
46
+ 'Name :name',
47
+ 'Account :account',
48
+ 'Domain :domain',
49
+ 'State :state'
50
+ ]
51
+
52
+ params = { 'command' => "listProjects" }
53
+ params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
54
+ params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
55
+ params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
56
+ params['name'] = locate_config_value(:name) if locate_config_value(:name)
57
+
58
+ result = connection.list_object(params, "project")
59
+ list_object(columns, result)
89
60
  end
90
61
 
91
62
  end
@@ -16,20 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cs_base'
19
+ require 'chef/knife'
20
20
  require 'chef/knife/cs_baselist'
21
21
 
22
22
  module KnifeCloudstack
23
23
  class CsPublicipList < Chef::Knife
24
24
 
25
- include Chef::Knife::KnifeCloudstackBase
26
25
  include Chef::Knife::KnifeCloudstackBaseList
27
26
 
28
- deps do
29
- require 'knife-cloudstack/connection'
30
- Chef::Knife.load_deps
31
- end
32
-
33
27
  banner "knife cs publicip list (options)"
34
28
 
35
29
  option :listall,
@@ -40,48 +34,21 @@ module KnifeCloudstack
40
34
  def run
41
35
  validate_base_options
42
36
 
43
- if locate_config_value(:fields)
44
- object_list = []
45
- locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
46
- else
47
- object_list = [
48
- ui.color('IP', :bold),
49
- ui.color('Account', :bold),
50
- ui.color('Domain', :bold),
51
- ui.color('Zone', :bold),
52
- ui.color('State', :bold),
53
- ui.color('Allocated', :bold)
54
- ]
55
- end
56
-
57
- columns = object_list.count
58
- object_list = [] if locate_config_value(:noheader)
59
-
60
- connection_result = connection.list_object(
61
- "listPublicIpAddresses",
62
- "publicipaddress",
63
- locate_config_value(:filter),
64
- locate_config_value(:listall),
65
- locate_config_value(:keyword),
66
- locate_config_value(:name)
67
- )
68
-
69
- output_format(connection_result)
70
-
71
- connection_result.each do |r|
72
- if locate_config_value(:fields)
73
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
74
- else
75
- object_list << r['ipaddress'].to_s
76
- object_list << r['account'].to_s
77
- object_list << r['domain'].to_s
78
- object_list << r['zonename'].to_s
79
- object_list << r['state'].to_s
80
- object_list << r['allocated'].to_s
81
- end
82
- end
83
- puts ui.list(object_list, :uneven_columns_across, columns)
84
- list_object_fields(connection_result) if locate_config_value(:fieldlist)
37
+ columns = [
38
+ 'IP :ipaddress',
39
+ 'Account :account',
40
+ 'Domain :domain',
41
+ 'Zone :zonename',
42
+ 'State :state',
43
+ 'Allocated :allocated'
44
+ ]
45
+
46
+ params = { 'command' => "listPublicIpAddresses" }
47
+ params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
48
+ params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
49
+
50
+ result = connection.list_object(params, "publicipaddress")
51
+ list_object(columns, result)
85
52
  end
86
53
 
87
54
  end
@@ -16,20 +16,14 @@
16
16
  # limitations under the License.
17
17
  #
18
18
 
19
- require 'chef/knife/cs_base'
19
+ require 'chef/knife'
20
20
  require 'chef/knife/cs_baselist'
21
21
 
22
22
  module KnifeCloudstack
23
23
  class CsRouterList < Chef::Knife
24
24
 
25
- include Chef::Knife::KnifeCloudstackBase
26
25
  include Chef::Knife::KnifeCloudstackBaseList
27
26
 
28
- deps do
29
- require 'knife-cloudstack/connection'
30
- Chef::Knife.load_deps
31
- end
32
-
33
27
  banner "knife cs router list (options)"
34
28
 
35
29
  option :listall,
@@ -48,46 +42,22 @@ module KnifeCloudstack
48
42
  def run
49
43
  validate_base_options
50
44
 
51
- if locate_config_value(:fields)
52
- object_list = []
53
- locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
54
- else
55
- object_list = [
56
- ui.color('Name', :bold),
57
- ui.color('Account', :bold),
58
- ui.color('Domain', :bold),
59
- ui.color('State', :bold),
60
- ui.color('Address', :bold)
61
- ]
62
- end
63
-
64
- columns = object_list.count
65
- object_list = [] if locate_config_value(:noheader)
66
-
67
- connection_result = connection.list_object(
68
- "listRouters",
69
- "router",
70
- locate_config_value(:filter),
71
- locate_config_value(:listall),
72
- locate_config_value(:keyword),
73
- locate_config_value(:name)
74
- )
75
-
76
- output_format(connection_result)
45
+ columns = [
46
+ 'Name :name',
47
+ 'Account :account',
48
+ 'Domain :domain',
49
+ 'State :state',
50
+ 'Address :publicip'
51
+ ]
77
52
 
78
- connection_result.each do |r|
79
- if locate_config_value(:fields)
80
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
81
- else
82
- object_list << r['name'].to_s
83
- object_list << r['account'].to_s
84
- object_list << r['domain'].to_s
85
- object_list << r['state'].to_s
86
- object_list << r['publicip'].to_s
87
- end
88
- end
89
- puts ui.list(object_list, :uneven_columns_across, columns)
90
- list_object_fields(connection_result) if locate_config_value(:fieldlist)
53
+ params = { 'command' => "listRouters" }
54
+ params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
55
+ params['listall'] = locate_config_value(:listall) if locate_config_value(:listall)
56
+ params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
57
+ params['name'] = locate_config_value(:name) if locate_config_value(:name)
58
+
59
+ result = connection.list_object(params, "router")
60
+ list_object(columns, result)
91
61
  end
92
62
 
93
63
  end
@@ -1,4 +1,4 @@
1
- #
1
+ #
2
2
  # Author:: Ryan Holmes (<rholmes@edmunds.com>)
3
3
  # Author:: Sander Botman (<sbotman@schubergphilis.com>)
4
4
  # Author:: Sebastien Goasguen (<runseb@gmail.com>)
@@ -19,21 +19,14 @@
19
19
  # limitations under the License.
20
20
  #
21
21
 
22
- require 'chef/knife/cs_base'
22
+ require 'chef/knife'
23
23
  require 'chef/knife/cs_baselist'
24
24
 
25
25
  module KnifeCloudstack
26
26
  class CsSecuritygroupList < Chef::Knife
27
27
 
28
- include Chef::Knife::KnifeCloudstackBase
29
28
  include Chef::Knife::KnifeCloudstackBaseList
30
-
31
- deps do
32
- require 'chef/knife'
33
- require 'knife-cloudstack/connection'
34
- Chef::Knife.load_deps
35
- end
36
-
29
+
37
30
  banner "knife cs securitygroup list (options)"
38
31
 
39
32
  option :name,
@@ -44,90 +37,22 @@ module KnifeCloudstack
44
37
  :long => "--keyword NAME",
45
38
  :description => "Specify part of servicename to list"
46
39
 
47
- option :index,
48
- :long => "--index",
49
- :description => "Add index numbers to the output",
50
- :boolean => true
51
-
52
40
  def run
53
41
  validate_base_options
54
-
55
- object_list = []
56
- object_list << ui.color('Index', :bold) if locate_config_value(:index)
57
-
58
- if locate_config_value(:fields)
59
- locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
60
- elsif locate_config_value(:keyword)
61
- [
62
- ui.color('Name', :bold),
63
- ui.color('Description', :bold),
64
- ui.color('Account', :bold),
65
- ui.color('IngressRules', :bold)
66
- ].each { |field| object_list << field }
67
- else
68
- [
69
- ui.color('Name', :bold),
70
- ui.color('Description', :bold),
71
- ui.color('Account', :bold)
72
- ].each { |field| object_list << field }
73
- end
74
42
 
75
- columns = object_list.count
76
- object_list = [] if locate_config_value(:noheader)
43
+ columns = [
44
+ 'Name :name',
45
+ 'Description :description',
46
+ 'Account :account'
47
+ ]
77
48
 
78
- connection_result = connection.list_object(
79
- "listSecurityGroups",
80
- "securitygroup",
81
- locate_config_value(:filter),
82
- false,
83
- locate_config_value(:keyword),
84
- locate_config_value(:name)
85
- )
86
-
87
- output_format(connection_result)
88
-
89
- if locate_config_value(:keyword)
90
- index_num = 0
91
- connection_result['ingressrule'].each do |r|
92
- if r.nil?
93
- else
94
- if locate_config_value(:index)
95
- index_num += 1
96
- object_list << index_num.to_s
97
- end
98
-
99
- if locate_config_value(:fields)
100
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
101
- else
102
- object_list << connection_result['name'].to_s
103
- object_list << connection_result['description'].to_s
104
- object_list << connection_result['account'].to_s
105
- object_list << r.to_s
106
- end
107
- end
108
- end
109
-
110
- else
111
- index_num = 0
112
- connection_result.each do |r|
113
- if locate_config_value(:index)
114
- index_num += 1
115
- object_list << index_num.to_s
116
- end
117
-
118
- if locate_config_value(:fields)
119
- locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
120
- else
121
- object_list << r['name'].to_s
122
- object_list << r['description'].to_s
123
- object_list << r['account'].to_s
124
- end
125
- end
126
-
127
- end
49
+ params = { 'command' => "listSecurityGroups" }
50
+ params['filter'] = locate_config_value(:filter) if locate_config_value(:filter)
51
+ params['keyword'] = locate_config_value(:keyword) if locate_config_value(:keyword)
52
+ params['name'] = locate_config_value(:name) if locate_config_value(:name)
128
53
 
129
- puts ui.list(object_list, :uneven_columns_across, columns)
130
- list_object_fields(connection_result) if locate_config_value(:fieldlist)
54
+ result = connection.list_object(params, "securitygroup")
55
+ list_object(columns, result)
131
56
  end
132
57
 
133
58
  end
@@ -0,0 +1,109 @@
1
+ #
2
+ # Author:: John E. Vincent (<lusis.org+github.com@gmail.com>)
3
+ # Copyright:: Copyright (c) 2013 John E. Vincent
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'chef/knife/cs_base'
20
+ require 'chef/knife/cs_baselist'
21
+
22
+ module KnifeCloudstack
23
+ class CsServerAddNic < Chef::Knife
24
+
25
+ include Chef::Knife::KnifeCloudstackBase
26
+ include Chef::Knife::KnifeCloudstackBaseList
27
+
28
+ deps do
29
+ require 'knife-cloudstack/connection'
30
+ require 'chef/knife'
31
+ Chef::Knife.load_deps
32
+ end
33
+
34
+ banner "knife cs server add nic SERVERID NETWORKID (--ipaddress X.X.X.X)"
35
+
36
+ option :ipaddress,
37
+ :long => "--ipaddress IPADDRESS",
38
+ :description => "Attach with the specified IP",
39
+ :default => nil
40
+
41
+
42
+ def run
43
+ validate_base_options
44
+
45
+ @server_id, @network_id = name_args
46
+
47
+ if @network_id.nil? || @server_id.nil?
48
+ show_usage
49
+ ui.fatal("You must provide both a network id and a server id")
50
+ exit(1)
51
+ end
52
+
53
+ @ipaddr = locate_config_value(:ipaddress)
54
+
55
+ object_list = []
56
+ if locate_config_value(:fields)
57
+ locate_config_value(:fields).split(',').each { |n| object_list << ui.color(("#{n}").strip, :bold) }
58
+ else
59
+ object_list << ui.color('Server', :bold)
60
+ object_list << ui.color('Network', :bold)
61
+ object_list << ui.color('Type', :bold)
62
+ object_list << ui.color('Default', :bold)
63
+ object_list << ui.color('Address', :bold)
64
+ object_list << ui.color('Gateway', :bold)
65
+ object_list << ui.color('Netmask', :bold)
66
+ object_list << ui.color('ID', :bold)
67
+ end
68
+
69
+ columns = object_list.count
70
+
71
+ connection_result = connection.add_nic_to_vm(
72
+ @network_id,
73
+ @server_id,
74
+ @ipaddr
75
+ )
76
+
77
+ output_format(connection_result)
78
+
79
+ object_list << connection_result['name']
80
+ object_list << ''
81
+ object_list << ''
82
+ object_list << ''
83
+ object_list << ''
84
+ object_list << ''
85
+ object_list << ''
86
+ object_list << ''
87
+ if connection_result['nic']
88
+ connection_result['nic'].each do |r|
89
+ if locate_config_value(:fields)
90
+ locate_config_value(:fields).downcase.split(',').each { |n| object_list << ((r[("#{n}").strip]).to_s || 'N/A') }
91
+ else
92
+ object_list << ''
93
+ object_list << r['networkname'].to_s
94
+ object_list << r['type'].to_s
95
+ object_list << (r['isdefault'] ? r['isdefault'].to_s : 'false')
96
+ object_list << (r['ipaddress'] || '')
97
+ object_list << (r['gateway'] || '')
98
+ object_list << (r['netmask'] || '')
99
+ object_list << (r['networkid'] || '')
100
+ end
101
+ end
102
+ puts ui.list(object_list, :uneven_columns_across, columns)
103
+ list_object_fields(connection_result) if locate_config_value(:fieldlist)
104
+ else
105
+ ui.error("No nics returned in response")
106
+ end
107
+ end
108
+ end
109
+ end