Sha256: c9458c7b52ba621144143710979c915737ee2082fec9ece49200e89dbe8bcd4a

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require_relative "data_handler_base"

class Chef
  module ChefFS
    module DataHandler
      class ContainerDataHandler < DataHandlerBase
        def normalize(container, entry)
          normalize_hash(container, {
            "containername" => remove_dot_json(entry.name),
            "containerpath" => remove_dot_json(entry.name),
          })
        end

        def preserve_key?(key)
          key == "containername"
        end

        # 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
        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

        # There is no chef_class for users, nor does to_ruby work.
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chef-15.1.36 lib/chef/chef_fs/data_handler/container_data_handler.rb
chef-15.1.36-universal-mingw32 lib/chef/chef_fs/data_handler/container_data_handler.rb
chef-15.0.300 lib/chef/chef_fs/data_handler/container_data_handler.rb
chef-15.0.298 lib/chef/chef_fs/data_handler/container_data_handler.rb
chef-15.0.293 lib/chef/chef_fs/data_handler/container_data_handler.rb