chef-metal-fog 0.6 → 0.6.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b1fdb71aedeacd1389f9b204d2518a566cd129f8
4
- data.tar.gz: 06a458753dad712619205ad5cccee51c8cbd00c3
3
+ metadata.gz: b5883afe070478a843245ccc9844ea0f355e9596
4
+ data.tar.gz: f3ea03361d9501d0860e32eadfbad2a0408164dc
5
5
  SHA512:
6
- metadata.gz: a3b39d661695873096fd28868f735e8d73266cc19b08e5ab646a092e0a8cee2dceebe4ab09aaf9c4f4de04248dafd42fc9bc5eba34d172480a2d5aec37e53329
7
- data.tar.gz: 1e0f3e6766d5aa9da0b38a2f8e236764bea3de9b68c54b4d70d13188e29ef4da2f5dcf47e11ac0b6e863aea7478b7d598a154341cf758f271f062c1368e5f563
6
+ metadata.gz: 580d1fc60224a67c4962f76c208ffa1691fb0b82b882e01769d624a066237fb2f4a413afb0591ca9562883373fe22dde212ebfd861374b772d63f031e7b12d3d
7
+ data.tar.gz: 83f6827b9ead2253391d5a409c32a869e40e2d4d31ab36cba8880f338e6ccac5149a14cd8732bd3129f08de1006d15ee4850b76d9a027f0ac9244a7e059b797c
@@ -497,17 +497,25 @@ module ChefMetalFog
497
497
  }.merge(machine_options[:ssh_options] || {})
498
498
  if server.respond_to?(:private_key) && server.private_key
499
499
  result[:key_data] = [ server.private_key ]
500
- elsif server.respond_to?(:key_name)
501
- result[:key_data] = [ get_private_key(server.key_name) ]
500
+ elsif server.respond_to?(:key_name) && server.key_name
501
+ key = get_private_key(server.key_name)
502
+ if !key
503
+ raise "Server has key name '#{server.key_name}', but the corresponding private key was not found locally. Check if the key is in Chef::Config.private_key_paths: #{Chef::Config.private_key_paths.join(', ')}"
504
+ end
505
+ result[:key_data] = [ key ]
502
506
  elsif machine_spec.location['key_name']
503
- result[:key_data] = [ get_private_key(machine_spec.location['key_name']) ]
507
+ key = get_private_key(machine_spec.location['key_name'])
508
+ if !key
509
+ raise "Server was created with key name '#{machine_spec.location['key_name']}', but the corresponding private key was not found locally. Check if the key is in Chef::Config.private_key_paths: #{Chef::Config.private_key_paths.join(', ')}"
510
+ end
511
+ result[:key_data] = [ key ]
504
512
  elsif machine_options[:bootstrap_options][:key_path]
505
513
  result[:key_data] = [ IO.read(machine_options[:bootstrap_options][:key_path]) ]
506
514
  elsif machine_options[:bootstrap_options][:key_name]
507
515
  result[:key_data] = [ get_private_key(machine_options[:bootstrap_options][:key_name]) ]
508
516
  else
509
517
  # TODO make a way to suggest other keys to try ...
510
- raise "No key found to connect to #{machine_spec.name}!"
518
+ raise "No key found to connect to #{machine_spec.name} (#{machine_spec.location.inspect})!"
511
519
  end
512
520
  result
513
521
  end
@@ -23,7 +23,7 @@ module ChefMetalFog
23
23
  def bootstrap_options_for(action_handler, machine_spec, machine_options)
24
24
  bootstrap_options = symbolize_keys(machine_options[:bootstrap_options] || {})
25
25
 
26
- unless !bootstrap_options[:key_name]
26
+ if !bootstrap_options[:key_name]
27
27
  bootstrap_options[:key_name] = overwrite_default_key_willy_nilly(action_handler)
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module ChefMetalFog
2
- VERSION = '0.6'
2
+ VERSION = '0.6.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal-fog
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.6'
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser