summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McLellan <btm@opscode.com>2012-10-19 11:01:43 -0700
committerBryan McLellan <btm@opscode.com>2012-10-19 11:01:43 -0700
commit70e0f24b1c223878d4783bfa47a47a2e009dea42 (patch)
tree826011ed0676cbba80226388e1bc1d9e49f6886a
parent406c7f759a98efe293df96a29ad889d7fd41f6b1 (diff)
downloadchef-70e0f24b1c223878d4783bfa47a47a2e009dea42.tar.gz
Fix bug detecting 404 from RR endpoint
-rw-r--r--chef/lib/chef/resource_reporter.rb2
-rw-r--r--chef/spec/unit/resource_reporter_spec.rb8
2 files changed, 8 insertions, 2 deletions
diff --git a/chef/lib/chef/resource_reporter.rb b/chef/lib/chef/resource_reporter.rb
index 3d10c1e961..8155f8b7a7 100644
--- a/chef/lib/chef/resource_reporter.rb
+++ b/chef/lib/chef/resource_reporter.rb
@@ -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
diff --git a/chef/spec/unit/resource_reporter_spec.rb b/chef/spec/unit/resource_reporter_spec.rb
index bc8e3995f7..e0bc3a0f2f 100644
--- a/chef/spec/unit/resource_reporter_spec.rb
+++ b/chef/spec/unit/resource_reporter_spec.rb
@@ -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