summaryrefslogtreecommitdiff
path: root/lib/chef/rest.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/rest.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/rest.rb')
-rw-r--r--lib/chef/rest.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/rest.rb b/lib/chef/rest.rb
index a1139d7fa2..73ca4b3293 100644
--- a/lib/chef/rest.rb
+++ b/lib/chef/rest.rb
@@ -36,6 +36,7 @@ require 'chef/http/validate_content_length'
require 'chef/config'
require 'chef/exceptions'
require 'chef/platform/query_helpers'
+require 'chef/http/remote_request_id'
class Chef
# == Chef::REST
@@ -62,6 +63,7 @@ class Chef
@decompressor = Decompressor.new(options)
@authenticator = Authenticator.new(options)
+ @request_id = RemoteRequestID.new(options)
@middlewares << ValidateContentLength.new(options)
@middlewares << JSONInput.new(options)
@@ -69,6 +71,8 @@ class Chef
@middlewares << CookieManager.new(options)
@middlewares << @decompressor
@middlewares << @authenticator
+ @middlewares << @request_id
+
end
def signing_key_filename
@@ -132,7 +136,7 @@ class Chef
def raw_http_request(method, path, headers, data)
url = create_url(path)
method, url, headers, data = @authenticator.handle_request(method, url, headers, data)
-
+ method, url, headers, data = @request_id.handle_request(method, url, headers, data)
response, rest_request, return_value = send_http_request(method, url, headers, data)
response.error! unless success_response?(response)
return_value