16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 16
def resolved_ansible_content
content = []
additions = ansible_content_assignments.where(subtractive: false)
if hostgroup
hostgroup_content = hostgroup.ansible_content_assignments
subtractions = ansible_content_assignments.where(subtractive: true).map do |assignment|
assignment.consumable.id
end
if subtractions.empty?
hostgroup_content.each do |content_assignment|
content << content_assignment unless subtractions.include? content_assignment.consumable.id
end
else
content.concat hostgroup_content
end
end
content.concat additions
end
|