summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThom May <thom@may.lt>2016-10-19 10:17:25 +0100
committerGitHub <noreply@github.com>2016-10-19 10:17:25 +0100
commite2cbecd2b2b4e36fc961192974e0dd3c616e8dd0 (patch)
treed10da2fa6456f3c2cda1c04d2e11348eef9dc6ad
parenta3560355598af58051661aa22e2d4e26c3656c6c (diff)
parent73510d27e6286a89dc6818161d57292731162eef (diff)
downloadchef-e2cbecd2b2b4e36fc961192974e0dd3c616e8dd0.tar.gz
Merge pull request #5463 from chef/tm/last_json_deprecations
[Knife] Fix deprecation warning when creating data bag items
-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 b1b263bb6f..8d40e06a43 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -539,7 +539,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