Sha256: d427dc6229791908cd3d2d7a4150d2b4d57c0fb7ab4befcc1c06be942e5a484c

Contents?: true

Size: 1.29 KB

Versions: 8

Compression:

Stored size: 1.29 KB

Contents

# Author:: Kevin Moser <kevin.moser@nordstrom.com>
# Copyright:: Copyright 2013, Nordstrom, Inc.
# License:: Apache License, Version 2.0

# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at

#     http://www.apache.org/licenses/LICENSE-2.0

# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

class ChefVault
  module ChefPatch
    class ApiClient < Chef::ApiClient
      # Fix an issue where core Chef::ApiClient does not load
      # the private key for Chef 10
      def self.load(name)
        response = http_api.get("clients/#{name}")
        if response.kind_of?(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

          client
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
chef-vault-2.2.3 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.2.2 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.2.1 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.2.0 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.1.0 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.0.2 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.0.1 lib/chef-vault/chef_patch/api_client.rb
chef-vault-2.0.1.pre lib/chef-vault/chef_patch/api_client.rb