diff options
author | John Keiser <jkeiser@opscode.com> | 2013-10-11 13:14:36 -0700 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-10-11 13:14:36 -0700 |
commit | bff6f43e38dfadffe4431065a28f5d581b83b8e3 (patch) | |
tree | a20057f6584312225007dd33ca90b6ab043ebfc0 /lib/chef/cookbook_uploader.rb | |
parent | 6d58ff931dda2d5bfa0eb8b7feadf5cd0fb37c8e (diff) | |
download | chef-bff6f43e38dfadffe4431065a28f5d581b83b8e3.tar.gz |
Fix DELETE requests for -z for all endpoints, and PUT/POST for cookbooks
Diffstat (limited to 'lib/chef/cookbook_uploader.rb')
-rw-r--r-- | lib/chef/cookbook_uploader.rb | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/chef/cookbook_uploader.rb b/lib/chef/cookbook_uploader.rb index 9ba5b2bd8b..3ead26e56d 100644 --- a/lib/chef/cookbook_uploader.rb +++ b/lib/chef/cookbook_uploader.rb @@ -137,15 +137,17 @@ class Chef timestamp = Time.now.utc.iso8601 file_contents = File.open(file, "rb") {|f| f.read} # TODO - 5/28/2010, cw: make signing and sending the request streaming - sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object( - :http_method => :put, - :path => URI.parse(url).path, - :body => file_contents, - :timestamp => timestamp, - :user_id => rest.client_name - ) headers = { 'content-type' => 'application/x-binary', 'content-md5' => checksum64, :accept => 'application/json' } - headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key))) + if rest.signing_key + sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object( + :http_method => :put, + :path => URI.parse(url).path, + :body => file_contents, + :timestamp => timestamp, + :user_id => rest.client_name + ) + headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key))) + end begin RestClient::Resource.new(url, :headers=>headers, :timeout=>1800, :open_timeout=>1800).put(file_contents) |