Module: ForemanMonitoring::HostgroupExtensions

Extended by:
ActiveSupport::Concern
Defined in:
app/models/concerns/foreman_monitoring/hostgroup_extensions.rb

Instance Method Summary collapse

Instance Method Details

#inherited_monitoring_proxy_idObject



13
14
15
16
17
# File 'app/models/concerns/foreman_monitoring/hostgroup_extensions.rb', line 13

def inherited_monitoring_proxy_id
  return monitoring_proxy_id if ancestry.blank?

  self[:monitoring_proxy_id] || self.class.sort_by_ancestry(ancestors.where('monitoring_proxy_id is not NULL')).last.try(:monitoring_proxy_id)
end

#monitoring_proxyObject



7
8
9
10
11
# File 'app/models/concerns/foreman_monitoring/hostgroup_extensions.rb', line 7

def monitoring_proxy
  return super if ancestry.blank?

  SmartProxy.find_by(id: inherited_monitoring_proxy_id)
end