knife-rackspace 0.5.16 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +7 -0
- data/README.rdoc +22 -7
- data/knife-rackspace.gemspec +1 -1
- data/lib/chef/knife/rackspace_base.rb +96 -11
- data/lib/chef/knife/rackspace_flavor_list.rb +24 -9
- data/lib/chef/knife/rackspace_server_create.rb +24 -12
- data/lib/chef/knife/rackspace_server_delete.rb +13 -7
- data/lib/chef/knife/rackspace_server_list.rb +5 -5
- data/lib/knife-rackspace/version.rb +1 -1
- metadata +4 -4
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## v0.6.0
|
2
|
+
* KNIFE_RACKSPACE-39 support for Rackspace Open Cloud (v2)
|
3
|
+
* server list puts the name in second column
|
4
|
+
* flavor list supports VCPUs for v2
|
5
|
+
* server delete for v2 will attempt the name when purging since we set the name
|
6
|
+
* docs updated to reflect all of the regions and APIs supported
|
7
|
+
|
1
8
|
## v0.5.16
|
2
9
|
* KNIFE_RACKSPACE-36 Changed to code to use IP address for bootstrapping
|
3
10
|
* KNIFE_RACKSPACE-38 Support the -P --purge option
|
data/README.rdoc
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
= DESCRIPTION:
|
4
4
|
|
5
|
-
This is the official Opscode Knife plugin for Rackspace. This plugin gives knife the ability to create, bootstrap, and manage servers on the Rackspace Cloud.
|
5
|
+
This is the official Opscode Knife plugin for Rackspace Cloud Servers. This plugin gives knife the ability to create, bootstrap, and manage servers on all the regions for Rackspace Cloud Servers.
|
6
6
|
|
7
7
|
= INSTALLATION:
|
8
8
|
|
@@ -33,10 +33,23 @@ You also have the option of passing your Rackspace API Username/Key into the ind
|
|
33
33
|
# provision a new 1GB Ubuntu 10.04 webserver
|
34
34
|
knife rackspace server create -I 112 -f 3 -A 'Your Rackspace API username' -K "Your Rackspace API Key" -r 'role[webserver]'
|
35
35
|
|
36
|
-
|
36
|
+
To select for the new OpenStack-based "Rackspace Open Cloud" API (aka 'v2'), you can use the <tt>--rackspace-version v2</tt> command option. 'v1' is still the default, so if you're using exclusively 'v2' you will probably want to add the following to your <tt>knife.rb</tt>:
|
37
|
+
|
38
|
+
knife[:rackspace_version] = 'v2'
|
39
|
+
|
40
|
+
This plugin also has support for authenticating against an alternate API Auth URL. This is useful if you are a Rackspace Cloud UK user, here is an example of configuring your <tt>knife.rb</tt>:
|
37
41
|
|
38
42
|
knife[:rackspace_api_auth_url] = "lon.auth.api.rackspacecloud.com"
|
39
43
|
|
44
|
+
This plugin also has support for specifying which region to create servers into:
|
45
|
+
|
46
|
+
knife[:rackspace_endpoint] = "https://dfw.servers.api.rackspacecloud.com/v2"
|
47
|
+
|
48
|
+
valid options include:
|
49
|
+
DFW_ENDPOINT = 'https://dfw.servers.api.rackspacecloud.com/v2'
|
50
|
+
ORD_ENDPOINT = 'https://ord.servers.api.rackspacecloud.com/v2'
|
51
|
+
LON_ENDPOINT = 'https://lon.servers.api.rackspacecloud.com/v2'
|
52
|
+
|
40
53
|
Additionally the following options may be set in your `knife.rb`:
|
41
54
|
|
42
55
|
* flavor
|
@@ -50,23 +63,25 @@ This plugin provides the following Knife subcommands. Specific command options c
|
|
50
63
|
|
51
64
|
== knife rackspace server create
|
52
65
|
|
53
|
-
Provisions a new server in the Rackspace Cloud and then perform a Chef bootstrap (using the SSH protocol). The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists (provided by the provisioning). It is primarily intended for Chef Client systems that talk to a Chef server. By default the server is bootstrapped using the {
|
66
|
+
Provisions a new server in the Rackspace Cloud and then perform a Chef bootstrap (using the SSH protocol). The goal of the bootstrap is to get Chef installed on the target system so it can run Chef Client with a Chef Server. The main assumption is a baseline OS installation exists (provided by the provisioning). It is primarily intended for Chef Client systems that talk to a Chef server. By default the server is bootstrapped using the {chef-full}[https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/chef-full.erb] template. This can be overridden using the <tt>-d</tt> or <tt>--template-file</tt> command options.
|
67
|
+
|
68
|
+
If no name is provided, nodes created with the v1 API are named after their instance ID, with the v2 API they are given a random 'rs-XXXXXXXXX' name.
|
54
69
|
|
55
70
|
== knife rackspace server delete
|
56
71
|
|
57
|
-
Deletes an existing server in the currently configured Rackspace Cloud account by the server/instance id. You can find the instance id by entering 'knife rackspace server list'. Please note - this does not delete the associated node and client objects from the Chef server unless you pass the <tt>-P</tt> or <tt>--purge</tt> command option.
|
72
|
+
Deletes an existing server in the currently configured Rackspace Cloud account by the server/instance id. You can find the instance id by entering 'knife rackspace server list'. Please note - this does not delete the associated node and client objects from the Chef server unless you pass the <tt>-P</tt> or <tt>--purge</tt> command option. Using the <tt>--purge</tt> option with v2 nodes will attempt to delete the node and client by the name of the node.
|
58
73
|
|
59
74
|
== knife rackspace server list
|
60
75
|
|
61
|
-
Outputs a list of all servers in the currently configured Rackspace Cloud account. Please note - this shows all instances associated with the account, some of which may not be currently managed by the Chef server.
|
76
|
+
Outputs a list of all servers in the currently configured Rackspace Cloud account. Please note - this shows all instances associated with the account, some of which may not be currently managed by the Chef server. You may need to use the <tt>--rackspace-version</tt> and possibly a <tt>--rackspace-endpoint</tt> options to see nodes in different Rackspace regions.
|
62
77
|
|
63
78
|
== knife rackspace flavor list
|
64
79
|
|
65
|
-
Outputs a list of all available flavors (available hardware configuration for a server) available to the currently configured Rackspace Cloud account. Each flavor has a unique combination of disk space, memory capacity and priority for CPU time. This data can be useful when choosing a flavor id to pass to the <tt>knife rackspace server create</tt> subcommand.
|
80
|
+
Outputs a list of all available flavors (available hardware configuration for a server) available to the currently configured Rackspace Cloud account. Each flavor has a unique combination of disk space, memory capacity and priority for CPU time. This data can be useful when choosing a flavor id to pass to the <tt>knife rackspace server create</tt> subcommand. You may need to use the <tt>--rackspace-version</tt> and possibly a <tt>--rackspace-endpoint</tt> options to see nodes in different Rackspace regions.
|
66
81
|
|
67
82
|
== knife rackspace image list
|
68
83
|
|
69
|
-
Outputs a list of all available images available to the currently configured Rackspace Cloud account. An image is a collection of files used to create or rebuild a server. Rackspace provides a number of pre-built OS images by default. This data can be useful when choosing an image id to pass to the <tt>knife rackspace server create</tt> subcommand.
|
84
|
+
Outputs a list of all available images available to the currently configured Rackspace Cloud account. An image is a collection of files used to create or rebuild a server. Rackspace provides a number of pre-built OS images by default. This data can be useful when choosing an image id to pass to the <tt>knife rackspace server create</tt> subcommand. You may need to use the <tt>--rackspace-version</tt> and possibly a <tt>--rackspace-endpoint</tt> options to see nodes in different Rackspace regions.
|
70
85
|
|
71
86
|
|
72
87
|
= LICENSE:
|
data/knife-rackspace.gemspec
CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |s|
|
|
16
16
|
s.files = `git ls-files`.split("\n")
|
17
17
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
18
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
-
s.add_dependency "fog", "~> 1.
|
19
|
+
s.add_dependency "fog", "~> 1.6"
|
20
20
|
s.add_dependency "chef", ">= 0.10.10"
|
21
21
|
s.require_paths = ["lib"]
|
22
22
|
|
@@ -47,22 +47,57 @@ class Chef
|
|
47
47
|
:description => "Your rackspace API username",
|
48
48
|
:proc => Proc.new { |username| Chef::Config[:knife][:rackspace_username] = username }
|
49
49
|
|
50
|
+
option :rackspace_version,
|
51
|
+
:long => '--rackspace-version VERSION',
|
52
|
+
:description => 'Rackspace Cloud Servers API version',
|
53
|
+
:default => "v1",
|
54
|
+
:proc => Proc.new { |version| Chef::Config[:knife][:rackspace_version] = version }
|
55
|
+
|
50
56
|
option :rackspace_api_auth_url,
|
51
57
|
:long => "--rackspace-api-auth-url URL",
|
52
58
|
:description => "Your rackspace API auth url",
|
53
59
|
:default => "auth.api.rackspacecloud.com",
|
54
60
|
:proc => Proc.new { |url| Chef::Config[:knife][:rackspace_api_auth_url] = url }
|
61
|
+
|
62
|
+
option :rackspace_endpoint,
|
63
|
+
:long => "--rackspace-endpoint URL",
|
64
|
+
:description => "Your rackspace API endpoint",
|
65
|
+
:default => "https://dfw.servers.api.rackspacecloud.com/v2",
|
66
|
+
:proc => Proc.new { |url| Chef::Config[:knife][:rackspace_endpoint] = url }
|
55
67
|
end
|
56
68
|
end
|
57
69
|
|
58
70
|
def connection
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
71
|
+
Chef::Log.debug("version #{Chef::Config[:knife][:rackspace_version]}") #config file
|
72
|
+
Chef::Log.debug("version #{config[:rackspace_version]}") #cli
|
73
|
+
Chef::Log.debug("rackspace_api_key #{Chef::Config[:knife][:rackspace_api_key]}")
|
74
|
+
Chef::Log.debug("rackspace_username #{Chef::Config[:knife][:rackspace_username]}")
|
75
|
+
Chef::Log.debug("rackspace_api_username #{Chef::Config[:knife][:rackspace_api_username]}")
|
76
|
+
Chef::Log.debug("rackspace_auth_url #{Chef::Config[:knife][:rackspace_auth_url]}")
|
77
|
+
Chef::Log.debug("rackspace_auth_url #{config[:rackspace_api_auth_url]}")
|
78
|
+
Chef::Log.debug("rackspace_endpoint #{Chef::Config[:knife][:rackspace_endpoint]}")
|
79
|
+
Chef::Log.debug("rackspace_endpoint #{config[:rackspace_endpoint]}")
|
80
|
+
if (Chef::Config[:knife][:rackspace_version] == 'v2') || (config[:rackspace_version] == 'v2')
|
81
|
+
@connection ||= begin
|
82
|
+
connection = Fog::Compute.new(
|
83
|
+
:provider => 'Rackspace',
|
84
|
+
:version => 'v2',
|
85
|
+
:rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
|
86
|
+
:rackspace_username => (Chef::Config[:knife][:rackspace_username] || Chef::Config[:knife][:rackspace_api_username]),
|
87
|
+
:rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url],
|
88
|
+
:rackspace_endpoint => Chef::Config[:knife][:rackspace_endpoint] || config[:rackspace_endpoint]
|
89
|
+
)
|
90
|
+
end
|
91
|
+
else
|
92
|
+
@connection ||= begin
|
93
|
+
connection = Fog::Compute.new(
|
94
|
+
:provider => 'Rackspace',
|
95
|
+
:version => 'v1',
|
96
|
+
:rackspace_api_key => Chef::Config[:knife][:rackspace_api_key],
|
97
|
+
:rackspace_username => (Chef::Config[:knife][:rackspace_username] || Chef::Config[:knife][:rackspace_api_username]),
|
98
|
+
:rackspace_auth_url => Chef::Config[:knife][:rackspace_api_auth_url] || config[:rackspace_api_auth_url]
|
99
|
+
)
|
100
|
+
end
|
66
101
|
end
|
67
102
|
end
|
68
103
|
|
@@ -77,15 +112,65 @@ class Chef
|
|
77
112
|
end
|
78
113
|
end
|
79
114
|
|
115
|
+
def public_ip(server)
|
116
|
+
if version_one?
|
117
|
+
v1_public_ip(server)
|
118
|
+
else
|
119
|
+
v2_public_ip(server)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def private_ip(server)
|
124
|
+
if version_one?
|
125
|
+
v1_private_ip(server)
|
126
|
+
else
|
127
|
+
v2_private_ip(server)
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
80
131
|
def public_dns_name(server)
|
132
|
+
ip_address = public_ip(server)
|
133
|
+
|
81
134
|
@public_dns_name ||= begin
|
82
|
-
Resolv.getname(
|
135
|
+
Resolv.getname(ip_address)
|
83
136
|
rescue
|
84
|
-
"#{
|
137
|
+
"#{ip_address.gsub('.','-')}.static.cloud-ips.com"
|
85
138
|
end
|
86
139
|
end
|
140
|
+
|
141
|
+
private
|
142
|
+
|
143
|
+
def version_one?
|
144
|
+
rackspace_api_version == 'v1'
|
145
|
+
end
|
146
|
+
|
147
|
+
def rackspace_api_version
|
148
|
+
version = Chef::Config[:knife][:rackspace_version] || 'v1'
|
149
|
+
version.downcase
|
150
|
+
end
|
151
|
+
|
152
|
+
def v1_public_ip(server)
|
153
|
+
server.public_ip_address == nil ? "" : server.public_ip_address
|
154
|
+
end
|
155
|
+
|
156
|
+
def v1_private_ip(server)
|
157
|
+
server.addresses["private"].first == nil ? "" : server.addresses["private"].first
|
158
|
+
end
|
159
|
+
|
160
|
+
def v2_public_ip(server)
|
161
|
+
public_ips = server.addresses["public"]
|
162
|
+
extract_ipv4_address(public_ips) if public_ips
|
163
|
+
end
|
164
|
+
|
165
|
+
def v2_private_ip(server)
|
166
|
+
private_ips = server.addresses["private"]
|
167
|
+
extract_ipv4_address(private_ips) if private_ips
|
168
|
+
end
|
169
|
+
|
170
|
+
def extract_ipv4_address(ip_addresses)
|
171
|
+
address = ip_addresses.select { |ip| ip["version"] == 4 }.first
|
172
|
+
address ? address["addr"] : ""
|
173
|
+
end
|
87
174
|
end
|
88
175
|
end
|
89
176
|
end
|
90
|
-
|
91
|
-
|
@@ -27,21 +27,36 @@ class Chef
|
|
27
27
|
banner "knife rackspace flavor list (options)"
|
28
28
|
|
29
29
|
def run
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
30
|
+
if version_one?
|
31
|
+
flavor_list = [
|
32
|
+
ui.color('ID', :bold),
|
33
|
+
ui.color('Name', :bold),
|
34
|
+
ui.color('Architecture', :bold),
|
35
|
+
ui.color('RAM', :bold),
|
36
|
+
ui.color('Disk', :bold)
|
37
|
+
]
|
38
|
+
else
|
39
|
+
flavor_list = [
|
40
|
+
ui.color('ID', :bold),
|
41
|
+
ui.color('Name', :bold),
|
42
|
+
ui.color('VCPUs', :bold),
|
43
|
+
ui.color('RAM', :bold),
|
44
|
+
ui.color('Disk', :bold)
|
45
|
+
]
|
46
|
+
end
|
37
47
|
connection.flavors.sort_by(&:id).each do |flavor|
|
48
|
+
|
49
|
+
flavor = connection.flavors.get(flavor.id)
|
50
|
+
bits = flavor.respond_to?(:bits) ? "#{flavor.bits.to_s}-bit" : ""
|
51
|
+
|
38
52
|
flavor_list << flavor.id.to_s
|
39
53
|
flavor_list << flavor.name
|
40
|
-
flavor_list <<
|
54
|
+
flavor_list << bits if version_one?
|
55
|
+
flavor_list << flavor.vcpus.to_s unless version_one?
|
41
56
|
flavor_list << "#{flavor.ram.to_s}"
|
42
57
|
flavor_list << "#{flavor.disk.to_s} GB"
|
43
58
|
end
|
44
|
-
|
59
|
+
puts ui.list(flavor_list, :uneven_columns_across, 5)
|
45
60
|
end
|
46
61
|
end
|
47
62
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: Adam Jacob (<adam@opscode.com>)
|
3
|
-
#
|
3
|
+
# Author:: Matt Ray (<matt@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2009-2012 Opscode, Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -45,7 +46,7 @@ class Chef
|
|
45
46
|
:short => "-I IMAGE",
|
46
47
|
:long => "--image IMAGE",
|
47
48
|
:description => "The image of the server",
|
48
|
-
:proc => Proc.new { |i| Chef::Config[:knife][:image] = i.
|
49
|
+
:proc => Proc.new { |i| Chef::Config[:knife][:image] = i.to_s }
|
49
50
|
|
50
51
|
option :server_name,
|
51
52
|
:short => "-S NAME",
|
@@ -160,12 +161,14 @@ class Chef
|
|
160
161
|
exit 1
|
161
162
|
end
|
162
163
|
|
164
|
+
node_name = get_node_name(config[:chef_node_name] || config[:server_name])
|
165
|
+
|
163
166
|
server = connection.servers.create(
|
164
|
-
:name =>
|
167
|
+
:name => node_name,
|
165
168
|
:image_id => Chef::Config[:knife][:image],
|
166
169
|
:flavor_id => locate_config_value(:flavor),
|
167
170
|
:metadata => Chef::Config[:knife][:rackspace_metadata]
|
168
|
-
|
171
|
+
)
|
169
172
|
|
170
173
|
msg_pair("Instance ID", server.id)
|
171
174
|
msg_pair("Host ID", server.host_id)
|
@@ -182,16 +185,16 @@ class Chef
|
|
182
185
|
puts("\n")
|
183
186
|
|
184
187
|
msg_pair("Public DNS Name", public_dns_name(server))
|
185
|
-
msg_pair("Public IP Address", server
|
186
|
-
msg_pair("Private IP Address", server
|
188
|
+
msg_pair("Public IP Address", public_ip(server))
|
189
|
+
msg_pair("Private IP Address", private_ip(server))
|
187
190
|
msg_pair("Password", server.password)
|
188
191
|
|
189
192
|
print "\n#{ui.color("Waiting for sshd", :magenta)}"
|
190
193
|
|
191
194
|
#which IP address to bootstrap
|
192
|
-
bootstrap_ip_address = server
|
195
|
+
bootstrap_ip_address = public_ip(server)
|
193
196
|
if config[:private_network]
|
194
|
-
bootstrap_ip_address = server
|
197
|
+
bootstrap_ip_address = private_ip(server)
|
195
198
|
end
|
196
199
|
Chef::Log.debug("Bootstrap IP Address #{bootstrap_ip_address}")
|
197
200
|
if bootstrap_ip_address.nil?
|
@@ -203,7 +206,6 @@ class Chef
|
|
203
206
|
sleep @initial_sleep_delay ||= 10
|
204
207
|
puts("done")
|
205
208
|
}
|
206
|
-
|
207
209
|
bootstrap_for_node(server, bootstrap_ip_address).run
|
208
210
|
|
209
211
|
puts "\n"
|
@@ -214,8 +216,8 @@ class Chef
|
|
214
216
|
msg_pair("Image", server.image.name)
|
215
217
|
msg_pair("Metadata", server.metadata)
|
216
218
|
msg_pair("Public DNS Name", public_dns_name(server))
|
217
|
-
msg_pair("Public IP Address", server
|
218
|
-
msg_pair("Private IP Address", server
|
219
|
+
msg_pair("Public IP Address", public_ip(server))
|
220
|
+
msg_pair("Private IP Address", private_ip(server))
|
219
221
|
msg_pair("Password", server.password)
|
220
222
|
msg_pair("Environment", config[:environment] || '_default')
|
221
223
|
msg_pair("Run List", config[:run_list].join(', '))
|
@@ -230,7 +232,11 @@ class Chef
|
|
230
232
|
bootstrap.config[:ssh_password] = server.password
|
231
233
|
bootstrap.config[:identity_file] = config[:identity_file]
|
232
234
|
bootstrap.config[:host_key_verify] = config[:host_key_verify]
|
233
|
-
|
235
|
+
if version_one?
|
236
|
+
bootstrap.config[:chef_node_name] = config[:chef_node_name] || server.id
|
237
|
+
else
|
238
|
+
bootstrap.config[:chef_node_name] = server.name
|
239
|
+
end
|
234
240
|
bootstrap.config[:prerelease] = config[:prerelease]
|
235
241
|
bootstrap.config[:bootstrap_version] = locate_config_value(:bootstrap_version)
|
236
242
|
bootstrap.config[:distro] = locate_config_value(:distro)
|
@@ -242,5 +248,11 @@ class Chef
|
|
242
248
|
end
|
243
249
|
|
244
250
|
end
|
251
|
+
#v2 servers require a name, random if chef_node_name is empty, empty if v1
|
252
|
+
def get_node_name(chef_node_name)
|
253
|
+
return chef_node_name unless chef_node_name.nil?
|
254
|
+
#lazy uuids
|
255
|
+
chef_node_name = "rs-"+rand.to_s.split('.')[1] unless version_one?
|
256
|
+
end
|
245
257
|
end
|
246
258
|
end
|
@@ -62,13 +62,13 @@ class Chef
|
|
62
62
|
@name_args.each do |instance_id|
|
63
63
|
begin
|
64
64
|
server = connection.servers.get(instance_id)
|
65
|
-
msg_pair("Instance ID", server.id)
|
65
|
+
msg_pair("Instance ID", server.id.to_s)
|
66
66
|
msg_pair("Host ID", server.host_id)
|
67
67
|
msg_pair("Name", server.name)
|
68
68
|
msg_pair("Flavor", server.flavor.name)
|
69
69
|
msg_pair("Image", server.image.name)
|
70
|
-
msg_pair("Public IP Address", server
|
71
|
-
msg_pair("Private IP Address", server
|
70
|
+
msg_pair("Public IP Address", public_ip(server))
|
71
|
+
msg_pair("Private IP Address", private_ip(server))
|
72
72
|
|
73
73
|
puts "\n"
|
74
74
|
confirm("Do you really want to delete this server")
|
@@ -78,13 +78,19 @@ class Chef
|
|
78
78
|
ui.warn("Deleted server #{server.id}")
|
79
79
|
|
80
80
|
if config[:purge]
|
81
|
-
|
82
|
-
|
83
|
-
|
81
|
+
if version_one?
|
82
|
+
thing_to_delete = config[:chef_node_name] || instance_id
|
83
|
+
destroy_item(Chef::Node, thing_to_delete, "node")
|
84
|
+
destroy_item(Chef::ApiClient, thing_to_delete, "client")
|
85
|
+
else
|
86
|
+
#v2 nodes may be named automatically
|
87
|
+
thing_to_delete = config[:chef_node_name] || server.name
|
88
|
+
destroy_item(Chef::Node, thing_to_delete, "node")
|
89
|
+
destroy_item(Chef::ApiClient, thing_to_delete, "client")
|
90
|
+
end
|
84
91
|
else
|
85
92
|
ui.warn("Corresponding node and client for the #{instance_id} server were not deleted and remain registered with the Chef Server")
|
86
93
|
end
|
87
|
-
|
88
94
|
rescue NoMethodError
|
89
95
|
ui.error("Could not locate server '#{instance_id}'.")
|
90
96
|
end
|
@@ -31,20 +31,21 @@ class Chef
|
|
31
31
|
|
32
32
|
server_list = [
|
33
33
|
ui.color('Instance ID', :bold),
|
34
|
+
ui.color('Name', :bold),
|
34
35
|
ui.color('Public IP', :bold),
|
35
36
|
ui.color('Private IP', :bold),
|
36
37
|
ui.color('Flavor', :bold),
|
37
38
|
ui.color('Image', :bold),
|
38
|
-
ui.color('Name', :bold),
|
39
39
|
ui.color('State', :bold)
|
40
40
|
]
|
41
41
|
connection.servers.all.each do |server|
|
42
|
+
server = connection.servers.get(server.id)
|
42
43
|
server_list << server.id.to_s
|
43
|
-
server_list <<
|
44
|
-
server_list << (server
|
44
|
+
server_list << server.name
|
45
|
+
server_list << public_ip(server)
|
46
|
+
server_list << private_ip(server)
|
45
47
|
server_list << (server.flavor_id == nil ? "" : server.flavor_id.to_s)
|
46
48
|
server_list << (server.image_id == nil ? "" : server.image_id.to_s)
|
47
|
-
server_list << server.name
|
48
49
|
server_list << begin
|
49
50
|
case server.state.downcase
|
50
51
|
when 'deleted','suspended'
|
@@ -57,7 +58,6 @@ class Chef
|
|
57
58
|
end
|
58
59
|
end
|
59
60
|
puts ui.list(server_list, :uneven_columns_across, 7)
|
60
|
-
|
61
61
|
end
|
62
62
|
end
|
63
63
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-rackspace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-10-10 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: fog
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: '1.
|
23
|
+
version: '1.6'
|
24
24
|
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ~>
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: '1.
|
31
|
+
version: '1.6'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: chef
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|