Method: AttributesMap#generate

Defined in:
lib/mofa/attributes_map.rb

#generateObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/mofa/attributes_map.rb', line 23

def generate
  attr_all_roles = deep_merge(option_attributes, cookbook.mofa_yml.get_attr_for_role('all'))
  attr_all_roles_local = cookbook.mofa_yml_local.get_attr_for_role('all')
  attr_all_roles = deep_merge(attr_all_roles, attr_all_roles_local)

  hostlist.list.each do |hostname|
    # Again: the underlying rule here is -> shortname = role
    attr_host_role = cookbook.mofa_yml.get_attr_for_role(Hostlist::get_role(hostname))
    attr_host_role_local = cookbook.mofa_yml_local.get_attr_for_role(Hostlist::get_role(hostname))

    attr_host_role = deep_merge(attr_host_role, attr_host_role_local)
    attr_per_host = deep_merge(attr_all_roles, attr_host_role)

    attr_per_host = deep_parse(attr_per_host, '__SHORTNAME__', Hostlist::get_shortname(hostname))

    @mp.store(hostname, attr_per_host)
  end
end