Sha256: e44c2dcac87a15cd13adcd6de11ea871576e60cf0594970a191c4ccc3cb9bc71

Contents?: true

Size: 572 Bytes

Versions: 16

Compression:

Stored size: 572 Bytes

Contents

module ForemanAnsible
  # Relations to make Hostgroup 'have' ansible roles
  module HostgroupExtensions
    extend ActiveSupport::Concern

    included do
      has_many :hostgroup_ansible_roles, :foreign_key => :hostgroup_id
      has_many :ansible_roles, :through => :hostgroup_ansible_roles,
                               :dependent => :destroy
      include ForemanAnsible::HasManyAnsibleRoles

      def inherited_ansible_roles
        ancestors.reduce([]) do |roles, hostgroup|
          roles + hostgroup.ansible_roles
        end.uniq
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
foreman_ansible-2.0.4 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-2.0.3 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-2.0.2 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-2.0.1 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-2.0.0 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.4.6 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.4.5 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.4.3 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.4.2 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.4.1 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.4.0 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.3.1 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.3.0 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.2.1 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.2 app/models/concerns/foreman_ansible/hostgroup_extensions.rb
foreman_ansible-1.1 app/models/concerns/foreman_ansible/hostgroup_extensions.rb