def node_load_completed(node, expanded_run_list_with_versions, config)
@node = node
if reporting_enabled?
begin
resource_history_url = "reports/nodes/#{node.name}/runs"
server_response = @rest_client.post_rest(resource_history_url, {:action => :begin})
run_uri = URI.parse(server_response["uri"])
@run_id = ::File.basename(run_uri.path)
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 Chef::Config[:enable_reporting_url_fatals]
Chef::Log.error("Received exception #{"(" + e.response.code + ") " if e.response.code}attempting to generate run history id (URL Path: #{resource_history_url}), and enable_reporting_url_fatals is set, aborting run.")
raise
else
Chef::Log.info("Received exception #{"(" + e.response.code + ") " if e.response.code}attempting to generate run history id (URL Path: #{resource_history_url}), disabling reporting for this run.")
end
else
Chef::Log.debug("Received 404 attempting to generate run history id (URL Path: #{resource_history_url}), assuming feature is not supported on server.")
end
@reporting_enabled = false
end
end
end