chef-metal-fog 0.5.beta → 0.5.beta.2

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: 1dd0fd9efc928a98ed0742916d1bbbed1a2c13b3
4
- data.tar.gz: a4cb6fb64e7848db44f96ef6e4385bcd1fe1247d
3
+ metadata.gz: fdf92586a21978285397db7d6e107f393f497f3b
4
+ data.tar.gz: 9d46beeeae6d982ffa36b185679195e7e97db8c5
5
5
  SHA512:
6
- metadata.gz: 872bbb650218e9374713b63575849a25eb5dc296b0633ace402c5c19b791a5e8f68115df0546eb5297e87d586f5d3f24c22fc1c1b592784a95221358a70bf100
7
- data.tar.gz: 9455469c78c3d131ef9562cea69bb6a529dafa4f98f2f3bd8541012b66bddc2db08cbbbcf83a5266f1e72925c10ddaafde8f43f3a0dab5ada29c39301fb43ee6
6
+ metadata.gz: 662546f7745a1ec9a914951b6534a61b560c5d4b927e48705ad1cbeff229d8334bc1c8e74d0c0bb2f56436c6e51d671158cae49565cf40bc0b223aaf56d8feea
7
+ data.tar.gz: 1f9a2e09eea5a1c48e7d14f9b8b10ed4931315a713d66d03a60fea187c12003b24e5df41f08d4efe4e2252b655cf32b968fe64fab47505cc4a58954e682f30ab
@@ -51,11 +51,11 @@ class Chef::Provider::FogKeyPair < Chef::Provider::LWRPBase
51
51
  ensure_keys(action)
52
52
  end
53
53
 
54
- new_fingerprints = case new_driver.compute_options[:provider]
54
+ case new_driver.compute_options[:provider]
55
55
  when 'DigitalOcean'
56
- [Cheffish::KeyFormatter.encode(desired_key, :format => :openssh)]
56
+ new_fingerprints = [Cheffish::KeyFormatter.encode(desired_key, :format => :openssh)]
57
57
  when 'OpenStack'
58
- [Cheffish::KeyFormatter.encode(desired_key, :format => :openssh)]
58
+ new_fingerprints = [Cheffish::KeyFormatter.encode(desired_key, :format => :openssh)]
59
59
  else
60
60
  # “The nice thing about standards is that you have so many to
61
61
  # choose from.” - Andrew S. Tanenbaum
@@ -68,12 +68,14 @@ class Chef::Provider::FogKeyPair < Chef::Provider::LWRPBase
68
68
  #
69
69
  # So compute both possible AWS fingerprints and check if either of
70
70
  # them matches.
71
- [Cheffish::KeyFormatter.encode(desired_key, :format => :fingerprint),
72
- lambda { Cheffish::KeyFormatter.encode(desired_private_key,
73
- :format => :pkcs8sha1fingerprint) }]
71
+ new_fingerprints = [Cheffish::KeyFormatter.encode(desired_key, :format => :fingerprint)]
72
+ if RUBY_VERSION.to_f < 2.0
73
+ new_fingerprints << lambda { Cheffish::KeyFormatter.encode(desired_private_key,
74
+ :format => :pkcs8sha1fingerprint) }
75
+ end
74
76
  end
75
77
 
76
- if !new_fingerprints.any? { |f| (f.is_a?(Proc) ? f.call : f) == @current_fingerprint }
78
+ if !new_fingerprints.any? { |f| f == @current_fingerprint }
77
79
  if new_resource.allow_overwrite
78
80
  converge_by "update #{key_description} to match local key at #{new_resource.private_key_path}" do
79
81
  case new_driver.compute_options[:provider]
@@ -82,6 +84,7 @@ class Chef::Provider::FogKeyPair < Chef::Provider::LWRPBase
82
84
  when 'OpenStack'
83
85
  compute.create_key_pair(new_resource.name, Cheffish::KeyFormatter.encode(desired_key, :format => :openssh))
84
86
  else
87
+ compute.key_pairs.get(new_resource.name).destroy
85
88
  compute.import_key_pair(new_resource.name, Cheffish::KeyFormatter.encode(desired_key, :format => :openssh))
86
89
  end
87
90
  end
@@ -366,7 +366,10 @@ module ChefMetalFog
366
366
  end
367
367
 
368
368
  def symbolize_keys(options)
369
- options.inject({}) { |result,(key,value)| result[key.to_sym] = value; result }
369
+ options.inject({}) do |result,(key,value)|
370
+ result[key.to_sym] = value
371
+ result
372
+ end
370
373
  end
371
374
 
372
375
  def server_for(machine_spec)
@@ -540,7 +543,7 @@ module ChefMetalFog
540
543
  raise "unsupported fog provider #{provider}"
541
544
  end
542
545
  elsif provider == 'AWS'
543
- id = 'default'
546
+ driver_options[:aws_profile] = 'default'
544
547
  end
545
548
 
546
549
  # Set auth info from environment
@@ -578,45 +581,5 @@ module ChefMetalFog
578
581
 
579
582
  [ config, id ]
580
583
  end
581
-
582
- def get_default_private_key
583
- if config[:private_keys] && config[:private_keys].size > 0
584
- get_private_key(config[:private_keys].keys.first)
585
- else
586
- config[:private_key_paths].each do |private_key_path|
587
- Dir.entries(private_key_path).each do |key|
588
- ext = File.extname(key)
589
- if ext == '' || ext == '.pem'
590
- key_name = key[0..-(ext.length+1)]
591
- if key_name == name
592
- return IO.read("#{private_key_path}/#{key}")
593
- end
594
- end
595
- end
596
- end
597
- end
598
- end
599
-
600
- def get_private_key(name)
601
- if config[:private_keys] && config[:private_keys][name]
602
- if config[:private_keys][name].is_a?(String)
603
- IO.read(config[:private_keys][name])
604
- else
605
- config[:private_keys][name].to_pem
606
- end
607
- elsif config[:private_key_paths]
608
- config[:private_key_paths].each do |private_key_path|
609
- Dir.entries(private_key_path).each do |key|
610
- ext = File.extname(key)
611
- if ext == '' || ext == '.pem'
612
- key_name = key[0..-(ext.length+1)]
613
- if key_name == name
614
- return IO.read("#{private_key_path}/#{key}")
615
- end
616
- end
617
- end
618
- end
619
- end
620
- end
621
584
  end
622
585
  end
@@ -1,3 +1,3 @@
1
1
  module ChefMetalFog
2
- VERSION = '0.5.beta'
2
+ VERSION = '0.5.beta.2'
3
3
  end
metadata CHANGED
@@ -1,83 +1,83 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-metal-fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.beta
4
+ version: 0.5.beta.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-24 00:00:00.000000000 Z
11
+ date: 2014-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: cheffish
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0.4'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0.4'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: fog
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: Driver for creating Fog instances in Chef Metal.
@@ -88,18 +88,18 @@ extra_rdoc_files:
88
88
  - README.md
89
89
  - LICENSE
90
90
  files:
91
- - Rakefile
92
91
  - LICENSE
93
92
  - README.md
93
+ - Rakefile
94
94
  - lib/chef/provider/fog_key_pair.rb
95
95
  - lib/chef/resource/fog_key_pair.rb
96
96
  - lib/chef_metal/driver_init/fog.rb
97
+ - lib/chef_metal_fog.rb
97
98
  - lib/chef_metal_fog/aws_credentials.rb
98
99
  - lib/chef_metal_fog/fog_driver.rb
99
100
  - lib/chef_metal_fog/fog_driver_aws.rb
100
101
  - lib/chef_metal_fog/recipe_dsl.rb
101
102
  - lib/chef_metal_fog/version.rb
102
- - lib/chef_metal_fog.rb
103
103
  homepage: https://github.com/opscode/chef-metal-fog
104
104
  licenses: []
105
105
  metadata: {}
@@ -109,17 +109,17 @@ require_paths:
109
109
  - lib
110
110
  required_ruby_version: !ruby/object:Gem::Requirement
111
111
  requirements:
112
- - - '>='
112
+ - - ">="
113
113
  - !ruby/object:Gem::Version
114
114
  version: '0'
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - '>'
117
+ - - ">"
118
118
  - !ruby/object:Gem::Version
119
119
  version: 1.3.1
120
120
  requirements: []
121
121
  rubyforge_project:
122
- rubygems_version: 2.0.3
122
+ rubygems_version: 2.2.2
123
123
  signing_key:
124
124
  specification_version: 4
125
125
  summary: Driver for creating Fog instances in Chef Metal.