Skip to content

Commit 9efbc1e

Browse files
committed
Merge branch 'PL-505'
2 parents 91006f1 + a9c0085 commit 9efbc1e

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎chef/lib/chef/knife/data_bag_create.rb‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ class DataBagCreate < Knife
2525

2626
banner "Sub-Command: data bag create BAG [ITEM] (options)"
2727

28-
def run
28+
def run
29+
# create the data bag
30+
rest.post_rest("data", { "name" => @name_args[0] })
31+
Chef::Log.info("Created data_bag[#{@name_args[0]}]")
32+
33+
# if an item is specified, create it, as well
2934
if @name_args.length == 2
3035
create_object({ "id" => @name_args[1] }, "data_bag_item[#{@name_args[1]}]") do |output|
3136
rest.post_rest("data/#{@name_args[0]}", output)
3237
end
33-
else
34-
rest.post_rest("data", { "name" => @name_args[0] })
35-
Chef::Log.info("Created data_bag[#{@name_args[0]}]")
3638
end
3739
end
3840
end

0 commit comments

Comments
 (0)