summaryrefslogtreecommitdiff
path: root/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb')
-rw-r--r--lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
index 1f466ec5ac..240a42756d 100644
--- a/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
+++ b/lib/chef/chef_fs/data_handler/data_bag_item_data_handler.rb
@@ -10,16 +10,17 @@ class Chef
if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data']
data_bag_item = data_bag_item['raw_data']
end
- # chef_type and data_bag only come back from PUT and POST, but we'll
- # normalize them in in case someone is comparing with those results.
- super(data_bag_item, {
- 'chef_type' => 'data_bag_item',
- 'data_bag' => entry.parent.name,
+ # chef_type and data_bag come back in PUT and POST results, but we don't
+ # use those in knife-essentials.
+ normalize_hash(data_bag_item, {
'id' => remove_dot_json(entry.name)
})
end
def normalize_for_post(data_bag_item, entry)
+ if data_bag_item['json_class'] == 'Chef::DataBagItem' && data_bag_item['raw_data']
+ data_bag_item = data_bag_item['raw_data']
+ end
{
"name" => "data_bag_item_#{entry.parent.name}_#{remove_dot_json(entry.name)}",
"json_class" => "Chef::DataBagItem",