Commit 70e0f24b authored by Bryan McLellan's avatar Bryan McLellan
Browse files

Fix bug detecting 404 from RR endpoint

parent 406c7f75
......@@ -116,7 +116,7 @@ class Chef
Chef::Log.info("Chef server generated run history id: #{@run_id}")
@summary_only = server_response["summary_only"]
rescue Timeout::Error, Errno::EINVAL, Errno::ECONNRESET, EOFError, Net::HTTPBadResponse, Net::HTTPHeaderSyntaxError, Net::ProtocolError => e
if !e.response || e.response.code.to_s != 404
if !e.response || e.response.code.to_s != "404"
if Chef::Config[:enable_reporting_url_fatals]
Chef::Log.error("Received exception attempting to generate run history id (URL Path: #{resource_history_url}), and enable_reporting_url_fatals is set, aborting run.")
raise
......
......@@ -413,18 +413,24 @@ describe Chef::ResourceReporter do
@rest_client.should_receive(:post_rest).
with("reports/nodes/spitfire/runs", {:action => :begin}).
and_raise(@error)
@resource_reporter.node_load_completed(@node, :expanded_run_list, :config)
end
it "assumes the feature is not enabled" do
@resource_reporter.node_load_completed(@node, :expanded_run_list, :config)
@resource_reporter.reporting_enabled?.should be_false
end
it "does not send a resource report to the server" do
@resource_reporter.node_load_completed(@node, :expanded_run_list, :config)
@rest_client.should_not_receive(:post_rest)
@resource_reporter.run_completed(@node)
end
it "prints an error about the 404" do
Chef::Log.should_receive(:debug).with(/404/)
@resource_reporter.node_load_completed(@node, :expanded_run_list, :config)
end
end
context "when the server returns a 500 to the client" do
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment