Method: Chef::Compliance::Fetcher::ChefServer#handle_http_error_code

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

#handle_http_error_code(code) ⇒ Object

Raises:

  • (Inspec::FetcherFailure)


95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/chef/compliance/fetcher/chef_server.rb', line 95

def handle_http_error_code(code)
  case code
  when /401|403/
    Chef::Log.error "Auth issue: see the Compliance Phase troubleshooting documentation (http://docs.chef.io/chef_compliance_phase/#troubleshooting)."
  when /404/
    Chef::Log.error "Object does not exist on remote server."
  when /413/
    Chef::Log.error "You most likely hit the erchef request size in #{ChefUtils::Dist::Server::PRODUCT} that defaults to ~2MB. To increase this limit see the Compliance Phase troubleshooting documentation (http://docs.chef.io/chef_compliance_phase/#troubleshooting) or the Chef Infra Server configuration documentation (https://docs.chef.io/server/config_rb_server/)"
  when /429/
    Chef::Log.error "This error typically means the data sent was larger than #{ChefUtils::Dist::Automate::PRODUCT}'s limit (4 MB). Run InSpec locally to identify any controls producing large diffs."
  end
  msg = "Received HTTP error #{code}"
  Chef::Log.error msg
  raise Inspec::FetcherFailure, msg
end