Class: ChefVault::ChefPatch::ApiClient
- Inherits:
-
Chef::ApiClient
- Object
- Chef::ApiClient
- ChefVault::ChefPatch::ApiClient
- Defined in:
- lib/chef-vault/chef_patch/api_client.rb
Class Method Summary collapse
-
.load(name) ⇒ Object
Fix an issue where core Chef::ApiClient does not load the private key for Chef 10.
Class Method Details
.load(name) ⇒ Object
Fix an issue where core Chef::ApiClient does not load the private key for Chef 10
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/chef-vault/chef_patch/api_client.rb', line 22 def self.load(name) response = http_api.get("clients/#{name}") if response.is_a?(Chef::ApiClient) response else client = Chef::ApiClient.new client.name(response['clientname']) if response['certificate'] der = OpenSSL::X509::Certificate.new response['certificate'] client.public_key der.public_key.to_s end if response['public_key'] der = OpenSSL::PKey::RSA.new response['public_key'] client.public_key der.public_key.to_s end client end end |