Module: ForemanOpenscap::HostgroupExtensions

Extended by:
ActiveSupport::Concern
Includes:
InheritedPolicies
Defined in:
app/models/concerns/foreman_openscap/hostgroup_extensions.rb

Instance Method Summary collapse

Methods included from InheritedPolicies

#find_inherited_policies

Instance Method Details

#inherited_openscap_proxy_idObject



22
23
24
25
26
27
28
# File 'app/models/concerns/foreman_openscap/hostgroup_extensions.rb', line 22

def inherited_openscap_proxy_id
  if ancestry.present?
    self[:openscap_proxy_id] || self.class.sort_by_ancestry(ancestors.where.not(openscap_proxy_id: nil)).last.try(:openscap_proxy_id)
  else
    self.send(:openscap_proxy_id)
  end
end

#inherited_policiesObject



13
14
15
# File 'app/models/concerns/foreman_openscap/hostgroup_extensions.rb', line 13

def inherited_policies
  find_inherited_policies :policies
end

#openscap_proxyObject



17
18
19
20
# File 'app/models/concerns/foreman_openscap/hostgroup_extensions.rb', line 17

def openscap_proxy
  return super if ancestry.nil? || self.openscap_proxy_id.present?
  ::SmartProxy.find_by(:id => inherited_openscap_proxy_id)
end