# File lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb, line 36 def add_explanation(error_description) case exception when Errno::ECONNREFUSED, Timeout::Error, Errno::ETIMEDOUT, SocketError error_description.section("Networking Error:",#{exception.message}Your chef_server_url may be misconfigured, or the network could be down.) when Net::HTTPServerException, Net::HTTPFatalError humanize_http_exception(error_description) when Chef::Exceptions::MissingRole describe_missing_role(error_description) else error_description.section("Unexpected Error:","#{exception.class.name}: #{exception.message}") end end
# File lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb, line 69 def config Chef::Config end
# File lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb, line 53 def describe_missing_role(error_description) error_description.section("Missing Role(s) in Run List:", missing_roles_explained) original_run_list = node.run_list.map {|item| "* #{item}"}.join("\n") error_description.section("Original Run List", original_run_list) end
# File lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb, line 73 def humanize_http_exception(error_description) response = exception.response case response when Net::HTTPUnauthorized error_description.section("Authentication Error:",Failed to authenticate to the chef server (http 401).) error_description.section("Server Response:", format_rest_error) error_description.section("Relevant Config Settings:",chef_server_url "#{server_url}"node_name "#{username}"client_key "#{api_key}"If these settings are correct, your client_key may be invalid.) when Net::HTTPForbidden # TODO: we're rescuing errors from Node.find_or_create # * could be no write on nodes container # * could be no read on the node error_description.section("Authorization Error",Your client is not authorized to load one or more of your roles (HTTP 403).) error_description.section("Server Response:", format_rest_error) error_description.section("Possible Causes:",* Your client (#{username}) may have misconfigured authorization permissions.) when Net::HTTPInternalServerError error_description.section("Unknown Server Error:",The server had a fatal error attempting to load a role.) error_description.section("Server Response:", format_rest_error) when Net::HTTPBadGateway, Net::HTTPServiceUnavailable error_description.section("Server Unavailable","The Chef Server is temporarily unavailable") error_description.section("Server Response:", format_rest_error) else error_description.section("Unexpected API Request Failure:", format_rest_error) end end
# File lib/chef/formatters/error_inspectors/run_list_expansion_error_inspector.rb, line 59 def missing_roles_explained run_list_expansion.missing_roles_with_including_role.map do |role, includer| "* #{role} included by '#{includer}'" end.join("\n") end
Generated with the Darkfish Rdoc Generator 2.