summaryrefslogtreecommitdiff
path: root/lib/chef/client.rb
diff options
context:
space:
mode:
authorPrajaktaPurohit <prajakta@opscode.com>2014-01-19 18:07:17 -0800
committerPrajakta Purohit <prajakta@opscode.com>2014-02-07 15:31:10 -0800
commita4cdce667a1bc1828eea875bdf3f49af6d96da70 (patch)
treeccf5fb1bf44f0eda5ad0470f0957dd31864c62f0 /lib/chef/client.rb
parent29e732d97ec7e28b2111aca9f93edfd1bc257c2d (diff)
downloadchef-a4cdce667a1bc1828eea875bdf3f49af6d96da70.tar.gz
- Adding X-Remote-Request-Id to the set of headers for every request from CCR and
knife that will be sent to erchef - Each knife request has a different X-Remote-Request-Id, where as it remains the same for all requests originating from the same chef-client run. - Adding and fixing tests
Diffstat (limited to 'lib/chef/client.rb')
-rw-r--r--lib/chef/client.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/chef/client.rb b/lib/chef/client.rb
index 722c9915e9..638047331a 100644
--- a/lib/chef/client.rb
+++ b/lib/chef/client.rb
@@ -44,6 +44,7 @@ require 'chef/version'
require 'chef/resource_reporter'
require 'chef/run_lock'
require 'chef/policy_builder'
+require 'chef/request_id'
require 'ohai'
require 'rbconfig'
@@ -391,10 +392,12 @@ class Chef
# don't add code that may fail before entering this section to be sure to release lock
begin
runlock.save_pid
+ request_id = Chef::RequestID.instance.request_id
run_context = nil
@events.run_start(Chef::VERSION)
Chef::Log.info("*** Chef #{Chef::VERSION} ***")
Chef::Log.info "Chef-client pid: #{Process.pid}"
+ Chef::Log.debug("Chef-client request_id: #{request_id}")
enforce_path_sanity
run_ohai
@events.ohai_completed(node)
@@ -404,6 +407,7 @@ class Chef
build_node
+ run_status.run_id = request_id
run_status.start_clock
Chef::Log.info("Starting Chef Run for #{node.name}")
run_started
@@ -434,6 +438,8 @@ class Chef
@events.run_failed(e)
raise
ensure
+ Chef::RequestID.instance.reset_request_id
+ request_id = nil
@run_status = nil
run_context = nil
runlock.release