Module: ForemanAnsibleDirector::Concerns::HostExtensions

Extended by:
ActiveSupport::Concern
Includes:
Abstract::ContentResolutionNode
Defined in:
app/models/foreman_ansible_director/concerns/host_extensions.rb

Instance Method Summary collapse

Instance Method Details

#cr_content_assignmentsObject



45
46
47
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 45

def cr_content_assignments
  ansible_content_assignments
end

#cr_content_sourceObject



49
50
51
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 49

def cr_content_source
  ansible_lifecycle_environment
end

#cr_content_source_stateObject



53
54
55
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 53

def cr_content_source_state
  ansible_lifecycle_environment_state
end

#cr_immediate_predecessorObject



37
38
39
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 37

def cr_immediate_predecessor
  hostgroup
end

#cr_nameObject



41
42
43
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 41

def cr_name
  name
end

#resolved_ansible_contentObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 18

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