chef-ssl-client 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -29,10 +29,25 @@ module ChefSSL
29
29
  chef_server_url = Chef::Config.chef_server_url
30
30
  chef_server_url.gsub!(/\/$/, '')
31
31
 
32
+ if Chef::Config.ssl_verify_mode == :verify_none
33
+ verify_mode = OpenSSL::SSL::VERIFY_NONE
34
+ else
35
+ verify_mode = OpenSSL::SSL::VERIFY_PEER
36
+ end
37
+
32
38
  Spice.setup do |s|
33
39
  s.server_url = chef_server_url
34
40
  s.client_name = Chef::Config.node_name
35
41
  s.client_key = Spice.read_key_file(File.expand_path(Chef::Config.client_key))
42
+ s.connection_options = {
43
+ :ssl => {
44
+ :verify_mode => verify_mode,
45
+ :client_cert => Chef::Config.ssl_client_cert,
46
+ :client_key => Chef::Config.ssl_client_key,
47
+ :ca_path => Chef::Config.ssl_ca_path,
48
+ :ca_file => Chef::Config.ssl_ca_file,
49
+ }
50
+ }
36
51
  end
37
52
  end
38
53
 
@@ -4,6 +4,7 @@ require 'json'
4
4
  require 'openssl'
5
5
  require 'digest/sha2'
6
6
  require 'active_support/hash_with_indifferent_access'
7
+ require 'chef/knife'
7
8
  require 'chef/config'
8
9
  require 'chef/node'
9
10
 
@@ -16,11 +17,20 @@ module ChefSSL
16
17
  class Client
17
18
 
18
19
  def initialize
19
- path = File.expand_path('knife.rb', '~/.chef')
20
- Chef::Config.from_file(path)
20
+ Chef::Knife.new.tap do |knife|
21
+ # Set the log-level, knife style. This equals :error level
22
+ Chef::Config[:verbosity] = knife.config[:verbosity] ||= 0
23
+ knife.configure_chef
24
+ end
25
+
21
26
  Spice.reset
27
+
28
+ # avoid Spice issue if chef_server_url has a trailing slash.
29
+ chef_server_url = Chef::Config.chef_server_url
30
+ chef_server_url.gsub!(/\/$/, '')
31
+
22
32
  Spice.setup do |s|
23
- s.server_url = Chef::Config.chef_server_url
33
+ s.server_url = chef_server_url
24
34
  s.client_name = Chef::Config.node_name
25
35
  s.client_key = Spice.read_key_file(File.expand_path(Chef::Config.client_key))
26
36
  end
@@ -1,5 +1,5 @@
1
1
  module ChefSSL
2
2
  class Client
3
- VERSION = '1.0.4'
3
+ VERSION = '1.0.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-ssl-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-03 00:00:00.000000000 Z
12
+ date: 2013-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef
@@ -223,7 +223,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
223
223
  version: '0'
224
224
  segments:
225
225
  - 0
226
- hash: -1808698484037623876
226
+ hash: -3989254952748401307
227
227
  required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  none: false
229
229
  requirements:
@@ -232,7 +232,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
232
232
  version: '0'
233
233
  segments:
234
234
  - 0
235
- hash: -1808698484037623876
235
+ hash: -3989254952748401307
236
236
  requirements: []
237
237
  rubyforge_project:
238
238
  rubygems_version: 1.8.24