Sha256: 02e90a012f4f2bec42818275145668f386fef695126bd3a0f7c2160a11478c9b
Contents?: true
Size: 924 Bytes
Versions: 7
Compression:
Stored size: 924 Bytes
Contents
module ForemanOpenscap module HostgroupExtensions extend ActiveSupport::Concern included do has_one :asset, :as => :assetable, :class_name => "::ForemanOpenscap::Asset", dependent: :destroy has_many :asset_policies, :through => :asset, :class_name => "::ForemanOpenscap::AssetPolicy" has_many :policies, :through => :asset_policies, :class_name => "::ForemanOpenscap::Policy" end def inherited_policies return [] unless parent ancestors.inject([]) do |policies, hostgroup| policies += hostgroup.policies end.uniq end unless defined?(Katello::System) private def inherited_ancestry_attribute(attribute) if ancestry.present? self[attribute] || self.class.sort_by_ancestry(ancestors.where("#{attribute} is not NULL")).last.try(attribute) else self.send(attribute) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems