knife-cloudstack-fog 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/chef/knife/cloudstack_base.rb +101 -101
- data/lib/chef/knife/cloudstack_diskoffering_list.rb +57 -57
- data/lib/chef/knife/cloudstack_keypair_create.rb +102 -102
- data/lib/chef/knife/cloudstack_keypair_delete.rb +49 -49
- data/lib/chef/knife/cloudstack_keypair_list.rb +53 -53
- data/lib/chef/knife/cloudstack_network_create.rb +147 -147
- data/lib/chef/knife/cloudstack_network_delete.rb +53 -53
- data/lib/chef/knife/cloudstack_network_list.rb +67 -67
- data/lib/chef/knife/cloudstack_networkoffering_list.rb +74 -74
- data/lib/chef/knife/cloudstack_publicip_create.rb +90 -90
- data/lib/chef/knife/cloudstack_publicip_list.rb +57 -57
- data/lib/chef/knife/cloudstack_securitygroup_list.rb +124 -124
- data/lib/chef/knife/cloudstack_server_create.rb +320 -320
- data/lib/chef/knife/cloudstack_server_delete.rb +53 -53
- data/lib/chef/knife/cloudstack_server_destroy.rb +53 -53
- data/lib/chef/knife/cloudstack_server_list.rb +135 -135
- data/lib/chef/knife/cloudstack_server_start.rb +69 -69
- data/lib/chef/knife/cloudstack_server_stop.rb +72 -72
- data/lib/chef/knife/cloudstack_serviceoffering_list.rb +61 -61
- data/lib/chef/knife/cloudstack_template_list.rb +127 -127
- data/lib/chef/knife/cloudstack_volumes_list.rb +78 -78
- data/lib/chef/knife/cloudstack_zone_list.rb +63 -63
- data/lib/knife-cloudstack-fog/version.rb +1 -1
- metadata +2 -2
@@ -1,53 +1,53 @@
|
|
1
|
-
# Author:: Jeff Moody (<jmoody@datapipe.com>)
|
2
|
-
# Copyright:: Copyright (c) 2012 Datapipe
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
require 'chef/knife/cloudstack_base'
|
20
|
-
|
21
|
-
class Chef
|
22
|
-
class Knife
|
23
|
-
class CloudstackServerDelete < Knife
|
24
|
-
|
25
|
-
include Knife::CloudstackBase
|
26
|
-
banner "knife cloudstack server delete INSTANCE_ID"
|
27
|
-
|
28
|
-
def run
|
29
|
-
|
30
|
-
if @name_args.nil?
|
31
|
-
puts #{ui.color("Please provide an Instance ID.", :red)}
|
32
|
-
end
|
33
|
-
|
34
|
-
@name_args.each do |instance_id|
|
35
|
-
response = connection.list_virtual_machines('name' => instance_id)
|
36
|
-
instance_name = response['listvirtualmachinesresponse']['virtualmachine'].first['name']
|
37
|
-
instance_ip = response['listvirtualmachinesresponse']['virtualmachine'].first['nic'].first['ipaddress']
|
38
|
-
real_instance_id = response['listvirtualmachinesresponse']['virtualmachine'].first['id']
|
39
|
-
puts "#{ui.color("Name", :red)}: #{instance_name}"
|
40
|
-
puts "#{ui.color("Public IP", :red)}: #{instance_ip}"
|
41
|
-
puts "\n"
|
42
|
-
confirm("#{ui.color("Do you really want to delete this server", :red)}")
|
43
|
-
connection.destroy_virtual_machine('id' => real_instance_id)
|
44
|
-
ui.warn("Deleted server #{instance_name}")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
# Author:: Jeff Moody (<jmoody@datapipe.com>)
|
2
|
+
# Copyright:: Copyright (c) 2012 Datapipe
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
|
19
|
+
require 'chef/knife/cloudstack_base'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class CloudstackServerDelete < Knife
|
24
|
+
|
25
|
+
include Knife::CloudstackBase
|
26
|
+
banner "knife cloudstack server delete INSTANCE_ID"
|
27
|
+
|
28
|
+
def run
|
29
|
+
|
30
|
+
if @name_args.nil? || @name_args.empty?
|
31
|
+
puts "#{ui.color("Please provide an Instance ID.", :red)}"
|
32
|
+
end
|
33
|
+
|
34
|
+
@name_args.each do |instance_id|
|
35
|
+
response = connection.list_virtual_machines('name' => instance_id)
|
36
|
+
instance_name = response['listvirtualmachinesresponse']['virtualmachine'].first['name']
|
37
|
+
instance_ip = response['listvirtualmachinesresponse']['virtualmachine'].first['nic'].first['ipaddress']
|
38
|
+
real_instance_id = response['listvirtualmachinesresponse']['virtualmachine'].first['id']
|
39
|
+
puts "#{ui.color("Name", :red)}: #{instance_name}"
|
40
|
+
puts "#{ui.color("Public IP", :red)}: #{instance_ip}"
|
41
|
+
puts "\n"
|
42
|
+
confirm("#{ui.color("Do you really want to delete this server", :red)}")
|
43
|
+
connection.destroy_virtual_machine('id' => real_instance_id)
|
44
|
+
ui.warn("Deleted server #{instance_name}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,53 +1,53 @@
|
|
1
|
-
# Author:: Jeff Moody (<jmoody@datapipe.com>)
|
2
|
-
# Copyright:: Copyright (c) 2012 Datapipe
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
|
19
|
-
require 'chef/knife/cloudstack_base'
|
20
|
-
|
21
|
-
class Chef
|
22
|
-
class Knife
|
23
|
-
class CloudstackServerDestroy < Knife
|
24
|
-
|
25
|
-
include Knife::CloudstackBase
|
26
|
-
banner "knife cloudstack server destroy INSTANCE_ID"
|
27
|
-
|
28
|
-
def run
|
29
|
-
|
30
|
-
if @name_args.nil?
|
31
|
-
puts #{ui.color("Please provide an Instance ID.", :red)}
|
32
|
-
end
|
33
|
-
|
34
|
-
@name_args.each do |instance_id|
|
35
|
-
response = connection.list_virtual_machines('name' => instance_id)
|
36
|
-
instance_name = response['listvirtualmachinesresponse']['virtualmachine'].first['name']
|
37
|
-
instance_ip = response['listvirtualmachinesresponse']['virtualmachine'].first['nic'].first['ipaddress']
|
38
|
-
real_instance_id = response['listvirtualmachinesresponse']['virtualmachine'].first['id']
|
39
|
-
puts "#{ui.color("Name", :red)}: #{instance_name}"
|
40
|
-
puts "#{ui.color("Public IP", :red)}: #{instance_ip}"
|
41
|
-
puts "\n"
|
42
|
-
confirm("#{ui.color("Do you really want to destroy this server", :red)}")
|
43
|
-
connection.destroy_virtual_machine('id' => real_instance_id)
|
44
|
-
ui.warn("Destroyed server #{instance_name}")
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
end
|
52
|
-
end
|
53
|
-
end
|
1
|
+
# Author:: Jeff Moody (<jmoody@datapipe.com>)
|
2
|
+
# Copyright:: Copyright (c) 2012 Datapipe
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
|
19
|
+
require 'chef/knife/cloudstack_base'
|
20
|
+
|
21
|
+
class Chef
|
22
|
+
class Knife
|
23
|
+
class CloudstackServerDestroy < Knife
|
24
|
+
|
25
|
+
include Knife::CloudstackBase
|
26
|
+
banner "knife cloudstack server destroy INSTANCE_ID"
|
27
|
+
|
28
|
+
def run
|
29
|
+
|
30
|
+
if @name_args.nil? || @name_args.empty?
|
31
|
+
puts "#{ui.color("Please provide an Instance ID.", :red)}"
|
32
|
+
end
|
33
|
+
|
34
|
+
@name_args.each do |instance_id|
|
35
|
+
response = connection.list_virtual_machines('name' => instance_id)
|
36
|
+
instance_name = response['listvirtualmachinesresponse']['virtualmachine'].first['name']
|
37
|
+
instance_ip = response['listvirtualmachinesresponse']['virtualmachine'].first['nic'].first['ipaddress']
|
38
|
+
real_instance_id = response['listvirtualmachinesresponse']['virtualmachine'].first['id']
|
39
|
+
puts "#{ui.color("Name", :red)}: #{instance_name}"
|
40
|
+
puts "#{ui.color("Public IP", :red)}: #{instance_ip}"
|
41
|
+
puts "\n"
|
42
|
+
confirm("#{ui.color("Do you really want to destroy this server", :red)}")
|
43
|
+
connection.destroy_virtual_machine('id' => real_instance_id)
|
44
|
+
ui.warn("Destroyed server #{instance_name}")
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -1,135 +1,135 @@
|
|
1
|
-
# Author:: Chirag Jog (<chirag@clogeny.com>), Jeff Moody (<jmoody@datapipe.com>)
|
2
|
-
# Copyright:: Copyright (c) 2011 Clogeny Technologies, Copyright (c) 2012 Datapipe
|
3
|
-
# License:: Apache License, Version 2.0
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
#
|
17
|
-
|
18
|
-
require 'chef/knife/cloudstack_base'
|
19
|
-
|
20
|
-
class Chef
|
21
|
-
class Knife
|
22
|
-
class CloudstackServerList < Knife
|
23
|
-
|
24
|
-
include Knife::CloudstackBase
|
25
|
-
|
26
|
-
banner "knife cloudstack server list (options)"
|
27
|
-
option :zoneid,
|
28
|
-
:short => "-z ZONEID",
|
29
|
-
:long => "--zoneid ZONEID",
|
30
|
-
:description => "Limit responses to servers only running in a specific zone (specified by ID #). Default provides servers from all zones.",
|
31
|
-
:default => "all"
|
32
|
-
option :state,
|
33
|
-
:short => "-s STATE",
|
34
|
-
:long => "--state STATE",
|
35
|
-
:description => "Limit responses to servers only of a given state. Possible values are 'running,' 'stopped,' 'starting,' 'pending,' 'shutting-down,' 'terminated,' and 'stopping.' Default provides servers in all states.",
|
36
|
-
:default => "all"
|
37
|
-
=begin
|
38
|
-
#Commented out as sorting of VM list is a work-in-progress
|
39
|
-
option :sort,
|
40
|
-
:short => "-o TRUE/FALSE",
|
41
|
-
:long => "--sort TRUE/FALSE",
|
42
|
-
:description => "Enable or disable sorting by Zone ID then VM ID. Defaults to sorted.",
|
43
|
-
:default => true
|
44
|
-
=end
|
45
|
-
|
46
|
-
def print_servers(server_list,servers,options={})
|
47
|
-
server = servers
|
48
|
-
Chef::Log.debug("Servers: #{server}")
|
49
|
-
if zoneid = options[:zoneid]
|
50
|
-
server.reject!{|t| t['zoneid'] != zoneid}
|
51
|
-
end
|
52
|
-
if state = options[:state]
|
53
|
-
state.downcase!
|
54
|
-
server.reject!{|t| t['state'].downcase != state}
|
55
|
-
end
|
56
|
-
|
57
|
-
=begin
|
58
|
-
#Commented out as sorting of VM list is a work-in-progress
|
59
|
-
# Sorting to group by zone ID first, then VM ID
|
60
|
-
if vmsort = options[:sort]
|
61
|
-
sort1 = server.sort_by { |hsh| hsh["zoneid"] }
|
62
|
-
sorted = sort1.sort_by { |hsh| hsh["id"] }
|
63
|
-
else
|
64
|
-
sorted = server
|
65
|
-
end
|
66
|
-
=end
|
67
|
-
|
68
|
-
server.each do |instance|
|
69
|
-
server_list << instance['name'].to_s
|
70
|
-
server_list << instance['displayname'].to_s
|
71
|
-
ip_list = []
|
72
|
-
instance['nic'].each do |nic|
|
73
|
-
ip_list << nic['ipaddress'].to_s
|
74
|
-
end
|
75
|
-
server_list << ip_list.join(", ")
|
76
|
-
sg_list = []
|
77
|
-
instance['securitygroup'].each do |group|
|
78
|
-
sg_list << group['name'].to_s
|
79
|
-
end
|
80
|
-
server_list << sg_list.join(", ")
|
81
|
-
|
82
|
-
server_list << instance['zonename'].to_s
|
83
|
-
server_list << instance['serviceofferingname'].to_s
|
84
|
-
server_list << instance['templatedisplaytext'].to_s
|
85
|
-
server_list << instance['hypervisor'].to_s
|
86
|
-
|
87
|
-
server_list << begin
|
88
|
-
state = instance['state'].to_s.downcase
|
89
|
-
case state
|
90
|
-
when 'shutting-down','terminated','stopping','stopped'
|
91
|
-
ui.color(state, :red)
|
92
|
-
when 'pending', 'starting'
|
93
|
-
ui.color(state, :yellow)
|
94
|
-
else
|
95
|
-
ui.color(state, :green)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
end
|
101
|
-
|
102
|
-
def run
|
103
|
-
$stdout.sync = true
|
104
|
-
|
105
|
-
validate!
|
106
|
-
|
107
|
-
server_list = [
|
108
|
-
ui.color('Server ID', :bold),
|
109
|
-
ui.color('Display Name', :bold),
|
110
|
-
ui.color('IP Address', :bold),
|
111
|
-
ui.color('Security Group', :bold),
|
112
|
-
ui.color('Server Zone', :bold),
|
113
|
-
ui.color('Service Offering', :bold),
|
114
|
-
ui.color('Template', :bold),
|
115
|
-
ui.color('Hypervisor', :bold),
|
116
|
-
ui.color('State', :bold)
|
117
|
-
]
|
118
|
-
|
119
|
-
zoneid = locate_config_value(:zoneid)
|
120
|
-
state = locate_config_value(:state)
|
121
|
-
# vmsort = locate_config_value(:sort)
|
122
|
-
|
123
|
-
response = connection.list_virtual_machines['listvirtualmachinesresponse']
|
124
|
-
Chef::Log.debug("API request: #{response}")
|
125
|
-
if virtual_machines = response['virtualmachine']
|
126
|
-
filters = {}
|
127
|
-
filters[:zoneid] = zoneid unless zoneid == 'all'
|
128
|
-
filters[:state] = state unless state == 'all'
|
129
|
-
print_servers(server_list, virtual_machines, filters)
|
130
|
-
puts ui.list(server_list, :uneven_columns_across, 9)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
1
|
+
# Author:: Chirag Jog (<chirag@clogeny.com>), Jeff Moody (<jmoody@datapipe.com>)
|
2
|
+
# Copyright:: Copyright (c) 2011 Clogeny Technologies, Copyright (c) 2012 Datapipe
|
3
|
+
# License:: Apache License, Version 2.0
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
#
|
17
|
+
|
18
|
+
require 'chef/knife/cloudstack_base'
|
19
|
+
|
20
|
+
class Chef
|
21
|
+
class Knife
|
22
|
+
class CloudstackServerList < Knife
|
23
|
+
|
24
|
+
include Knife::CloudstackBase
|
25
|
+
|
26
|
+
banner "knife cloudstack server list (options)"
|
27
|
+
option :zoneid,
|
28
|
+
:short => "-z ZONEID",
|
29
|
+
:long => "--zoneid ZONEID",
|
30
|
+
:description => "Limit responses to servers only running in a specific zone (specified by ID #). Default provides servers from all zones.",
|
31
|
+
:default => "all"
|
32
|
+
option :state,
|
33
|
+
:short => "-s STATE",
|
34
|
+
:long => "--state STATE",
|
35
|
+
:description => "Limit responses to servers only of a given state. Possible values are 'running,' 'stopped,' 'starting,' 'pending,' 'shutting-down,' 'terminated,' and 'stopping.' Default provides servers in all states.",
|
36
|
+
:default => "all"
|
37
|
+
=begin
|
38
|
+
#Commented out as sorting of VM list is a work-in-progress
|
39
|
+
option :sort,
|
40
|
+
:short => "-o TRUE/FALSE",
|
41
|
+
:long => "--sort TRUE/FALSE",
|
42
|
+
:description => "Enable or disable sorting by Zone ID then VM ID. Defaults to sorted.",
|
43
|
+
:default => true
|
44
|
+
=end
|
45
|
+
|
46
|
+
def print_servers(server_list,servers,options={})
|
47
|
+
server = servers
|
48
|
+
Chef::Log.debug("Servers: #{server}")
|
49
|
+
if zoneid = options[:zoneid]
|
50
|
+
server.reject!{|t| t['zoneid'] != zoneid}
|
51
|
+
end
|
52
|
+
if state = options[:state]
|
53
|
+
state.downcase!
|
54
|
+
server.reject!{|t| t['state'].downcase != state}
|
55
|
+
end
|
56
|
+
|
57
|
+
=begin
|
58
|
+
#Commented out as sorting of VM list is a work-in-progress
|
59
|
+
# Sorting to group by zone ID first, then VM ID
|
60
|
+
if vmsort = options[:sort]
|
61
|
+
sort1 = server.sort_by { |hsh| hsh["zoneid"] }
|
62
|
+
sorted = sort1.sort_by { |hsh| hsh["id"] }
|
63
|
+
else
|
64
|
+
sorted = server
|
65
|
+
end
|
66
|
+
=end
|
67
|
+
|
68
|
+
server.each do |instance|
|
69
|
+
server_list << instance['name'].to_s
|
70
|
+
server_list << instance['displayname'].to_s
|
71
|
+
ip_list = []
|
72
|
+
instance['nic'].each do |nic|
|
73
|
+
ip_list << nic['ipaddress'].to_s
|
74
|
+
end
|
75
|
+
server_list << ip_list.join(", ")
|
76
|
+
sg_list = []
|
77
|
+
instance['securitygroup'].each do |group|
|
78
|
+
sg_list << group['name'].to_s
|
79
|
+
end
|
80
|
+
server_list << sg_list.join(", ")
|
81
|
+
|
82
|
+
server_list << instance['zonename'].to_s
|
83
|
+
server_list << instance['serviceofferingname'].to_s
|
84
|
+
server_list << instance['templatedisplaytext'].to_s
|
85
|
+
server_list << instance['hypervisor'].to_s
|
86
|
+
|
87
|
+
server_list << begin
|
88
|
+
state = instance['state'].to_s.downcase
|
89
|
+
case state
|
90
|
+
when 'shutting-down','terminated','stopping','stopped'
|
91
|
+
ui.color(state, :red)
|
92
|
+
when 'pending', 'starting'
|
93
|
+
ui.color(state, :yellow)
|
94
|
+
else
|
95
|
+
ui.color(state, :green)
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
end
|
101
|
+
|
102
|
+
def run
|
103
|
+
$stdout.sync = true
|
104
|
+
|
105
|
+
validate!
|
106
|
+
|
107
|
+
server_list = [
|
108
|
+
ui.color('Server ID', :bold),
|
109
|
+
ui.color('Display Name', :bold),
|
110
|
+
ui.color('IP Address', :bold),
|
111
|
+
ui.color('Security Group', :bold),
|
112
|
+
ui.color('Server Zone', :bold),
|
113
|
+
ui.color('Service Offering', :bold),
|
114
|
+
ui.color('Template', :bold),
|
115
|
+
ui.color('Hypervisor', :bold),
|
116
|
+
ui.color('State', :bold)
|
117
|
+
]
|
118
|
+
|
119
|
+
zoneid = locate_config_value(:zoneid)
|
120
|
+
state = locate_config_value(:state)
|
121
|
+
# vmsort = locate_config_value(:sort)
|
122
|
+
|
123
|
+
response = connection.list_virtual_machines['listvirtualmachinesresponse']
|
124
|
+
Chef::Log.debug("API request: #{response}")
|
125
|
+
if virtual_machines = response['virtualmachine']
|
126
|
+
filters = {}
|
127
|
+
filters[:zoneid] = zoneid unless zoneid == 'all'
|
128
|
+
filters[:state] = state unless state == 'all'
|
129
|
+
print_servers(server_list, virtual_machines, filters)
|
130
|
+
puts ui.list(server_list, :uneven_columns_across, 9)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
134
|
+
end
|
135
|
+
end
|