blob: 0facd5d55d0c7e7283dd55fc7130386d2711ea3f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
require "chef/chef_fs/data_handler/data_handler_base"
class Chef
module ChefFS
module DataHandler
class OrganizationDataHandler < DataHandlerBase
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
def preserve_key?(key)
return key == "name"
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)
if entry.org != object["name"]
yield("Name must be '#{entry.org}' (is '#{object['name']}')")
end
end
end
end
end
end
|