blob: 21c3013e9fc0305833a0a13169db62a2631f2c55 (
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
37
38
39
40
|
require 'chef/chef_fs/data_handler/data_handler_base'
require 'chef/role'
class Chef
module ChefFS
module DataHandler
class RoleDataHandler < DataHandlerBase
def normalize(role, entry)
result = normalize_hash(role, {
'name' => remove_dot_json(entry.name),
'description' => '',
'json_class' => 'Chef::Role',
'chef_type' => 'role',
'default_attributes' => {},
'override_attributes' => {},
'run_list' => [],
'env_run_lists' => {}
})
result['run_list'] = normalize_run_list(result['run_list'])
result['env_run_lists'].each_pair do |env, run_list|
result['env_run_lists'][env] = normalize_run_list(run_list)
end
result
end
def preserve_key?(key)
return key == 'name'
end
def chef_class
Chef::Role
end
def to_ruby(object)
to_ruby_keys(object, %w(name description default_attributes override_attributes run_list env_run_lists))
end
end
end
end
end
|