diff options
author | jkeiser <jkeiser@opscode.com> | 2013-01-19 14:12:26 -0800 |
---|---|---|
committer | John Keiser <jkeiser@opscode.com> | 2013-06-07 13:12:23 -0700 |
commit | 7792c55964ae27261940a01abba5fccf69fb3c1e (patch) | |
tree | 45726e2975fb3820362188ee0cbef183b47addc6 /lib/chef/chef_fs/data_handler | |
parent | 35fa7b8c09d97bf4bb141beca7e3ae537e79e08d (diff) | |
download | chef-7792c55964ae27261940a01abba5fccf69fb3c1e.tar.gz |
Don't minimize out the name/id of the container, for easy reading
Diffstat (limited to 'lib/chef/chef_fs/data_handler')
8 files changed, 34 insertions, 2 deletions
diff --git a/lib/chef/chef_fs/data_handler/client_data_handler.rb b/lib/chef/chef_fs/data_handler/client_data_handler.rb index b155ca4578..0da3bf929b 100644 --- a/lib/chef/chef_fs/data_handler/client_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/client_data_handler.rb @@ -15,6 +15,10 @@ class Chef }) end + def preserve_key(key) + return key == 'name' + end + def chef_class Chef::ApiClient end diff --git a/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb b/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb index d571f3d4ff..a911713f0e 100644 --- a/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/cookbook_data_handler.rb @@ -21,6 +21,10 @@ class Chef }) end + def preserve_key(key) + return key == 'cookbook_name' || key == 'version' + end + def chef_class Chef::Cookbook::Metadata end 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 43d5311f65..12f99e8cc4 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 @@ -19,6 +19,10 @@ class Chef }) end + def preserve_key(key) + return key == 'id' + end + def chef_class Chef::DataBagItem end diff --git a/lib/chef/chef_fs/data_handler/data_handler_base.rb b/lib/chef/chef_fs/data_handler/data_handler_base.rb index 66c3d9dbdc..72aef88e9c 100644 --- a/lib/chef/chef_fs/data_handler/data_handler_base.rb +++ b/lib/chef/chef_fs/data_handler/data_handler_base.rb @@ -3,15 +3,19 @@ class Chef module DataHandler class DataHandlerBase def minimize(object, *keys) - default_object = default({}, *keys) + default_object = default(*keys) object.each_pair do |key, value| - if default_object[key] == value + if default_object[key] == value && !preserve_key(key) object.delete(key) end end object end + def preserve_key(key) + false + end + def default(*keys) normalize({}, *keys) end diff --git a/lib/chef/chef_fs/data_handler/environment_data_handler.rb b/lib/chef/chef_fs/data_handler/environment_data_handler.rb index ccd7c6fc9b..3236c89107 100644 --- a/lib/chef/chef_fs/data_handler/environment_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/environment_data_handler.rb @@ -17,6 +17,10 @@ class Chef }) end + def preserve_key(key) + return key == 'name' + end + def chef_class Chef::Environment end diff --git a/lib/chef/chef_fs/data_handler/node_data_handler.rb b/lib/chef/chef_fs/data_handler/node_data_handler.rb index aed404d300..88e62677de 100644 --- a/lib/chef/chef_fs/data_handler/node_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/node_data_handler.rb @@ -21,6 +21,10 @@ class Chef result end + def preserve_key(key) + return key == 'name' + end + def chef_class Chef::Node end diff --git a/lib/chef/chef_fs/data_handler/role_data_handler.rb b/lib/chef/chef_fs/data_handler/role_data_handler.rb index f4365ca862..d2231a7298 100644 --- a/lib/chef/chef_fs/data_handler/role_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/role_data_handler.rb @@ -23,6 +23,10 @@ class Chef result end + def preserve_key(key) + return key == 'name' + end + def chef_class Chef::Role end diff --git a/lib/chef/chef_fs/data_handler/user_data_handler.rb b/lib/chef/chef_fs/data_handler/user_data_handler.rb index a1670c6913..a3f6b0e860 100644 --- a/lib/chef/chef_fs/data_handler/user_data_handler.rb +++ b/lib/chef/chef_fs/data_handler/user_data_handler.rb @@ -11,6 +11,10 @@ class Chef }) end + def preserve_key(key) + return key == 'name' + end + # There is no chef_class for users, nor does to_ruby work. end end |