knife-rackspace 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODUxNTU1NTRiNTE4MDg2MTczMDM3YmRjN2Q5ZGQyN2M0NWZiZDA4OA==
4
+ ZjY5N2QxMDNkZTRmNWU4ZTNiZTM4OTZjM2ZiNTAzNTc0NDA2YzFjNw==
5
5
  data.tar.gz: !binary |-
6
- OWJlMTYxZjM0MTJiYmYxYzFjNTQ1NjRkNWVkM2U4MTY4ZTJiYTQ2Mw==
6
+ YmIxNTg4Njc1ZDczOWFkMzE2Y2ZhNGU5OWI5MmU1OTdkMmUzMGJlMg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- NGFhYjRmNzY0ZDRlMTNkMGU3YTA2MTFjN2ZlYWQ0ZDRmZmQzNjYzYjY4NTI1
10
- ZTQ3OTZmOTA3ZTcxMDMzODA5MzVhOGFiMjhiYjkwNjYzYzVhYTA1ZmQzMzEx
11
- NWZjZGU4NjkxMzA5ZWRjMzFhNWIwZTJiZDUxNTNiNWFlYTY4Y2U=
9
+ YTA4MjgwZDM0NTg5ZmI0Y2RkYzg0NDg3NmY4OGMzNTBhOGU3NTYwNDM0MWRj
10
+ YTk1ZjM2N2YzZjk1Nzc5ODcyMjRjZDM3ZWIzNTQxMWMxZTI3OTA5MmViYjNm
11
+ YTdhNzRmZWZkN2EzMWE2NDJiZTNjNzAxZTQ2NzZmNjcxYjRkOGY=
12
12
  data.tar.gz: !binary |-
13
- MWJmZWQwMzIzZWJmZGM5NDU1ZDk1NGVmZTAxOTkwNTRlNmVkYjM3Y2E5NmJl
14
- MzkwNjBhMDhjOGI4OTJhNDg5YWNhZGI5NmUxMTQ3YzgxZWY3YzI3MGU5Y2M3
15
- YjdmODdlYzc4OWViYTZmNzdiMzVkZTg4MjMwNzg3NTg3YmZiY2E=
13
+ YTMwOTg0MzcxMTFlOGM1MTE3NmJlMWI4MGZmYTZmNmVmMDY0NjllMThjZDg2
14
+ YmUyOTkyZjgyMzJhMjcxY2MwZDI4NDI1ZTE1MzJhM2M2NGJhYTBmYzQxMTM4
15
+ YTE3ZTEwYmVhZTVjMzljNWFkNzAzNThhYjg2YWM1OGNlODk5NmU=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## v0.8.1
2
+ * KNIFE-335 Wait for RackConnect and/or Service Level automation before bootstrapping
3
+
1
4
  ## v0.8.0
2
5
  * KNIFE-68 enable ability to modify ssh port number
3
6
  * KNIFE-180 include option to pass :disk_config option to fog for new node bootstrap
@@ -154,7 +154,7 @@ class Chef
154
154
  if version_one?
155
155
  v1_public_ip(server)
156
156
  else
157
- v2_public_ip(server)
157
+ v2_access_ip(server) ? v2_access_ip(server) : v2_public_ip(server)
158
158
  end
159
159
  end
160
160
 
@@ -205,6 +205,10 @@ class Chef
205
205
  extract_ipv4_address(private_ips) if private_ips
206
206
  end
207
207
 
208
+ def v2_access_ip(server)
209
+ server.access_ipv4_address == nil ? "" : server.access_ipv4_address
210
+ end
211
+
208
212
  def extract_ipv4_address(ip_addresses)
209
213
  address = ip_addresses.select { |ip| ip["version"] == 4 }.first
210
214
  address ? address["addr"] : ""
@@ -136,6 +136,18 @@ class Chef
136
136
  :proc => Proc.new { |m| Chef::Config[:knife][:rackspace_metadata] = JSON.parse(m) },
137
137
  :default => ""
138
138
 
139
+ option :rackconnect_wait,
140
+ :long => "--rackconnect-wait",
141
+ :description => "Wait until the Rackconnect automation setup is complete before bootstrapping chef",
142
+ :boolean => true,
143
+ :default => false
144
+
145
+ option :rackspace_servicelevel_wait,
146
+ :long => "--rackspace-servicelevel-wait",
147
+ :description => "Wait until the Rackspace service level automation setup is complete before bootstrapping chef",
148
+ :boolean => true,
149
+ :default => false
150
+
139
151
  option :hint,
140
152
  :long => "--hint HINT_NAME[=HINT_FILE]",
141
153
  :description => "Specify Ohai Hint to be set on the bootstrap target. Use multiple --hint options to specify multiple hints.",
@@ -296,6 +308,9 @@ class Chef
296
308
  node_name = get_node_name(config[:chef_node_name] || config[:server_name])
297
309
  networks = get_networks(Chef::Config[:knife][:rackspace_networks])
298
310
 
311
+ rackconnect_wait = Chef::Config[:knife][:rackconnect_wait] || config[:rackconnect_wait]
312
+ rackspace_servicelevel_wait = Chef::Config[:knife][:rackspace_servicelevel_wait] || config[:rackspace_servicelevel_wait]
313
+
299
314
  server = connection.servers.new(
300
315
  :name => node_name,
301
316
  :image_id => Chef::Config[:knife][:image],
@@ -316,6 +331,36 @@ class Chef
316
331
  msg_pair("Name", server.name)
317
332
  msg_pair("Flavor", server.flavor.name)
318
333
  msg_pair("Image", server.image.name)
334
+ msg_pair("Metadata", server.metadata.all)
335
+ msg_pair("RackConnect Wait", rackconnect_wait ? 'yes' : 'no')
336
+ msg_pair("ServiceLevel Wait", rackspace_servicelevel_wait ? 'yes' : 'no')
337
+
338
+ # wait for it to be ready to do stuff
339
+ begin
340
+ server.wait_for(1200) {
341
+ print ".";
342
+ Chef::Log.debug("#{progress}%")
343
+ if rackconnect_wait and rackspace_servicelevel_wait
344
+ Chef::Log.debug("rackconnect_automation_status: #{metadata.all['rackconnect_automation_status']}")
345
+ Chef::Log.debug("rax_service_level_automation: #{metadata.all['rax_service_level_automation']}")
346
+ ready? and metadata.all['rackconnect_automation_status'] == 'DEPLOYED' and metadata.all['rax_service_level_automation'] == 'Complete'
347
+ elsif rackconnect_wait
348
+ Chef::Log.debug("rackconnect_automation_status: #{metadata.all['rackconnect_automation_status']}")
349
+ ready? and metadata.all['rackconnect_automation_status'] == 'DEPLOYED'
350
+ elsif rackspace_servicelevel_wait
351
+ Chef::Log.debug("rax_service_level_automation: #{metadata.all['rax_service_level_automation']}")
352
+ ready? and metadata.all['rax_service_level_automation'] == 'Complete'
353
+ else
354
+ ready?
355
+ end
356
+ }
357
+ rescue Fog::Errors::TimeoutError
358
+ ui.error('Timeout waiting for the server to be created')
359
+ msg_pair('Progress', "#{server.progress}%")
360
+ msg_pair('rackconnect_automation_status', server.metadata.all['rackconnect_automation_status'])
361
+ msg_pair('rax_service_level_automation', server.metadata.all['rax_service_level_automation'])
362
+ Chef::Application.fatal! 'Server didn\'t finish on time'
363
+ end
319
364
  msg_pair("Metadata", server.metadata)
320
365
  if(networks && Chef::Config[:knife][:rackspace_networks])
321
366
  msg_pair("Networks", Chef::Config[:knife][:rackspace_networks].sort.join(', '))
@@ -332,6 +377,8 @@ class Chef
332
377
  msg_pair("Public IP Address", public_ip(server))
333
378
  msg_pair("Private IP Address", private_ip(server))
334
379
  msg_pair("Password", server.password)
380
+ msg_pair("Metadata", server.metadata.all)
381
+
335
382
  #which IP address to bootstrap
336
383
  bootstrap_ip_address = public_ip(server)
337
384
  if config[:private_network]
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Rackspace
3
- VERSION = "0.8.0"
3
+ VERSION = "0.8.1"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  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.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Jacob
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-08-29 00:00:00.000000000 Z
13
+ date: 2013-09-03 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: knife-windows