class Chef::ChefFS::DataHandler::ContainerDataHandler
Public Instance Methods
normalize(container, entry)
click to toggle source
# File lib/chef/chef_fs/data_handler/container_data_handler.rb, line 7 def normalize(container, entry) normalize_hash(container, { "containername" => remove_dot_json(entry.name), "containerpath" => remove_dot_json(entry.name), }) end
preserve_key?(key)
click to toggle source
# File lib/chef/chef_fs/data_handler/container_data_handler.rb, line 14 def preserve_key?(key) key == "containername" end
verify_integrity(object, entry) { |"Name in #{path_for_printing} must be '#{base_name}' (is '#{object}')"| ... }
click to toggle source
Verify that the JSON hash for this type has a key that matches its name.
@param object [Object] JSON hash of the object @param entry [Chef::ChefFS::FileSystem::BaseFSObject] filesystem object we are verifying @yield [s] callback to handle errors @yieldparam [s<string>] error message
# File lib/chef/chef_fs/data_handler/container_data_handler.rb, line 24 def verify_integrity(object, entry) base_name = remove_dot_json(entry.name) if object["containername"] != base_name yield("Name in #{entry.path_for_printing} must be '#{base_name}' (is '#{object["containername"]}')") end end