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
- #cr_content_assignments ⇒ Object
- #cr_content_source ⇒ Object
- #cr_content_source_state ⇒ Object
- #cr_immediate_predecessor ⇒ Object
- #cr_name ⇒ Object
- #resolved_ansible_content ⇒ Object
Instance Method Details
#cr_content_assignments ⇒ Object
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_source ⇒ Object
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_state ⇒ Object
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_predecessor ⇒ Object
37 38 39 |
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 37 def cr_immediate_predecessor hostgroup end |
#cr_name ⇒ Object
41 42 43 |
# File 'app/models/foreman_ansible_director/concerns/host_extensions.rb', line 41 def cr_name name end |
#resolved_ansible_content ⇒ Object
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 |