class Chef::ChefFS::DataHandler::OrganizationDataHandler

Public Instance Methods

normalize(organization, entry) click to toggle source
# File lib/chef/chef_fs/data_handler/organization_data_handler.rb, line 7
def normalize(organization, entry)
  result = normalize_hash(organization, {
    "name" => entry.org,
    "full_name" => entry.org,
    "org_type" => "Business",
    "clientname" => "#{entry.org}-validator",
    "billing_plan" => "platform-free",
  })
  result
end
preserve_key?(key) click to toggle source
# File lib/chef/chef_fs/data_handler/organization_data_handler.rb, line 18
def preserve_key?(key)
  key == "name"
end
verify_integrity(object, entry) { |"Name must be '#{org}' (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/organization_data_handler.rb, line 28
def verify_integrity(object, entry)
  if entry.org != object["name"]
    yield("Name must be '#{entry.org}' (is '#{object['name']}')")
  end
end