summaryrefslogtreecommitdiff
path: root/lib/chef/data_bag.rb
diff options
context:
space:
mode:
authorJeremiah Snapp <jeremiah.snapp@opscode.com>2013-08-15 15:04:56 -0400
committerBryan McLellan <btm@opscode.com>2013-10-04 09:52:10 -0700
commitd3e9bbb6bd569b06ee270dfa446590499e1304f2 (patch)
treec8a43fea0e1ac6963f47dc12023c9b15c8d4250c /lib/chef/data_bag.rb
parent2546fbd5251c8feaad5b7b715ffbe67b335359d8 (diff)
downloadchef-d3e9bbb6bd569b06ee270dfa446590499e1304f2.tar.gz
Make Chef::DataBag.save use POST instead of PUT
PUT doesn't make sense in DataBag context since you can't update a data bag. Chef::DataBag.save should rescue a 409 response since that indicates the data bag already exists.
Diffstat (limited to 'lib/chef/data_bag.rb')
-rw-r--r--lib/chef/data_bag.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/chef/data_bag.rb b/lib/chef/data_bag.rb
index dcc01ec743..5994e6f8d1 100644
--- a/lib/chef/data_bag.rb
+++ b/lib/chef/data_bag.rb
@@ -129,11 +129,10 @@ class Chef
if Chef::Config[:why_run]
Chef::Log.warn("In whyrun mode, so NOT performing data bag save.")
else
- chef_server_rest.put_rest("data/#{@name}", self)
+ create
end
rescue Net::HTTPServerException => e
- raise e unless e.response.code == "404"
- chef_server_rest.post_rest("data", self)
+ raise e unless e.response.code == "409"
end
self
end