class Umami::PolicyfileServices::Push

Public Class Methods

new(policyfile: nil, ui: nil, policy_group: nil, config: nil, root_dir: nil) click to toggle source
Calls superclass method
# File lib/chef-umami/policyfile_services/push.rb, line 20
def initialize(policyfile: nil, ui: nil, policy_group: nil, config: nil, root_dir: nil)
  super(policyfile: policyfile, ui: ui, policy_group: policy_group,
        config: config, root_dir: root_dir)
end

Public Instance Methods

api_version() click to toggle source

Keep up with the times and force use of the newer API.

# File lib/chef-umami/policyfile_services/push.rb, line 26
def api_version
  '2'
end
http_client() click to toggle source

We'll override the http_client method to ensure we set the appropriate API version we expect to be used. Chef::Authenticator#request_version will use this to set the appropriate header that Chef Server (Zero) uses to determine how to generate cookbook manifests. Without this, we see issues during the Umami::Client#compile phase where Chef cannot locate recipes within a cookbook and `umami` fails miserably. I spent a week debugging this when trying to update `umami` to support newer Chef libraries. That, too, was miserable.

# File lib/chef-umami/policyfile_services/push.rb, line 38
def http_client
  @http_client ||= Chef::ServerAPI.new(config.chef_server_url,
                                       signing_key_filename: config.client_key,
                                       client_name: config.node_name,
                                       api_version: api_version)
end