diff options
author | danielsdeleo <dan@opscode.com> | 2013-10-18 10:54:32 -0700 |
---|---|---|
committer | danielsdeleo <dan@opscode.com> | 2013-10-18 11:07:08 -0700 |
commit | b0e918b22ae15a58af61c16509fafe82dc97cc16 (patch) | |
tree | 0a122daa16ffd3cd64685c858c42ce9f09cbff67 /lib/chef/http | |
parent | 4761c2e27ddb8dafcf224e4c51d3146ceba1f26f (diff) | |
download | chef-b0e918b22ae15a58af61c16509fafe82dc97cc16.tar.gz |
Fix error caused by loading duplicate trusted certs
Diffstat (limited to 'lib/chef/http')
-rw-r--r-- | lib/chef/http/ssl_policies.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/chef/http/ssl_policies.rb b/lib/chef/http/ssl_policies.rb index 17b46a6762..f2a9c5b845 100644 --- a/lib/chef/http/ssl_policies.rb +++ b/lib/chef/http/ssl_policies.rb @@ -79,7 +79,7 @@ class Chef certs = Dir.glob(File.join(config.trusted_certs_dir, "*.{crt,pem}")) certs.each do |cert_file| cert = OpenSSL::X509::Certificate.new(File.read(cert_file)) - http_client.cert_store.add_cert(cert) + add_trusted_cert(cert) end end end @@ -104,6 +104,14 @@ class Chef Chef::Config end + private + + def add_trusted_cert(cert) + http_client.cert_store.add_cert(cert) + rescue OpenSSL::X509::StoreError => e + raise e unless e.message == 'cert already in hash table' + end + end class APISSLPolicy < DefaultSSLPolicy |