Method: Chef::Compliance::Fetcher::ChefServer#download_archive_to_temp

Defined in:
lib/chef/compliance/fetcher/chef_server.rb

#download_archive_to_tempObject

Downloads archive to temporary file using a Chef::ServerAPI client so that Chef Server’s header-based authentication can be used.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/chef/compliance/fetcher/chef_server.rb', line 65

def download_archive_to_temp
  return @temp_archive_path unless @temp_archive_path.nil?

  rest = Chef::ServerAPI.new(@target, Chef::Config.merge(ssl_verify_mode: :verify_none))
  archive = with_http_rescue do
    rest.streaming_request(@target)
  end
  @archive_type = ".tar.gz"

  if archive.nil?
    path = @target.respond_to?(:path) ? @target.path : path
    raise Inspec::FetcherFailure, "Unable to find requested profile on path: '#{path}' on the #{ChefUtils::Dist::Automate::PRODUCT} system."
  end

  Inspec::Log.debug("Archive stored at temporary location: #{archive.path}")
  @temp_archive_path = archive.path
end