class Chef::ChefFS::DataHandler::PolicyGroupDataHandler

Public Instance Methods

normalize(policy_group, entry) click to toggle source
# File lib/chef/chef_fs/data_handler/policy_group_data_handler.rb, line 8
def normalize(policy_group, entry)
  defaults = {
    "name" => remove_dot_json(entry.name),
    "policies" => {},
  }
  result = normalize_hash(policy_group, defaults)
  result.delete("uri") # not useful data
  result
end
verify_integrity(object_data, entry) { |"Policy group #{object_data} does not have any policies in it."| ... } click to toggle source

Verify that the JSON hash for this type has a key that matches its name.

@param object_data [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/policy_group_data_handler.rb, line 24
def verify_integrity(object_data, entry)
  if object_data["policies"].empty?
    yield("Policy group #{object_data["name"]} does not have any policies in it.")
  end
end