summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@chef.io>2016-10-18 13:36:22 +0100
committerThom May <thom@chef.io>2016-10-18 14:14:13 +0100
commit73510d27e6286a89dc6818161d57292731162eef (patch)
treebd7e23454f54910dc8b7957257c65b542b813e92
parent1a58b3e8055a2f374e0da38eb7a1c49d035a7c1e (diff)
downloadchef-tm/last_json_deprecations.tar.gz
Return a raw hash when creating objectstm/last_json_deprecations
Fixes chef/chef-vault#215 Signed-off-by: Thom May <thom@may.lt>
-rw-r--r--lib/chef/knife.rb6
-rw-r--r--spec/integration/knife/data_bag_create_spec.rb3
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 0dbd02ceb4..7b7e2711f8 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -525,7 +525,11 @@ class Chef
# FIXME: yard with @yield
def create_object(object, pretty_name = nil, object_class: nil)
- output = edit_data(object, object_class: object_class)
+ output = if object_class
+ edit_data(object, object_class: object_class)
+ else
+ edit_hash(object)
+ end
if Kernel.block_given?
output = yield(output)
diff --git a/spec/integration/knife/data_bag_create_spec.rb b/spec/integration/knife/data_bag_create_spec.rb
index 0a07792dbc..dc61d55fd5 100644
--- a/spec/integration/knife/data_bag_create_spec.rb
+++ b/spec/integration/knife/data_bag_create_spec.rb
@@ -34,12 +34,10 @@ describe "knife data bag create", :workstation do
end
it "creates a new data bag and item" do
- pending "Deprecation warning must get fixed"
knife("data bag create foo bar").should_succeed stdout: out, stderr: err
end
it "adds a new item to an existing bag" do
- pending "Deprecation warning must get fixed"
knife("data bag create foo").should_succeed stderr: err
knife("data bag create foo bar").should_succeed stdout: out, stderr: exists
end
@@ -50,7 +48,6 @@ describe "knife data bag create", :workstation do
end
it "fails to add an existing item" do
- pending "Deprecation warning must get fixed"
knife("data bag create foo bar").should_succeed stdout: out, stderr: err
expect { knife("data bag create foo bar") }.to raise_error(Net::HTTPServerException)
end