diff options
Diffstat (limited to 'lib/chef/chef_fs/data_handler/container_data_handler.rb')
-rw-r--r-- | lib/chef/chef_fs/data_handler/container_data_handler.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/chef/chef_fs/data_handler/container_data_handler.rb b/lib/chef/chef_fs/data_handler/container_data_handler.rb new file mode 100644 index 0000000000..714f83824a --- /dev/null +++ b/lib/chef/chef_fs/data_handler/container_data_handler.rb @@ -0,0 +1,29 @@ +require 'chef/chef_fs/data_handler/data_handler_base' + +class Chef + module ChefFS + module DataHandler + class ContainerDataHandler < DataHandlerBase + def normalize(container, entry) + super(container, { + 'containername' => remove_dot_json(entry.name), + 'containerpath' => remove_dot_json(entry.name) + }) + end + + def preserve_key(key) + return key == 'containername' + end + + def verify_integrity(object, entry, &on_error) + base_name = remove_dot_json(entry.name) + if object['containername'] != base_name + on_error.call("Name in #{entry.path_for_printing} must be '#{base_name}' (is '#{object['name']}')") + end + end + + # There is no chef_class for users, nor does to_ruby work. + end + end + end +end |