Module: ForemanSpacewalk::HostgroupExtensions

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

Instance Method Summary collapse

Instance Method Details

#inherited_spacewalk_proxy_idObject



10
11
12
13
14
15
16
# File 'app/models/concerns/foreman_spacewalk/hostgroup_extensions.rb', line 10

def inherited_spacewalk_proxy_id
  return spacewalk_proxy_id unless ancestry.present?
  self[:spacewalk_proxy_id] ||
    self.class.sort_by_ancestry(
      ancestors.where('spacewalk_proxy_id is not NULL')
    ).last.try(:spacewalk_proxy_id)
end

#spacewalk_proxyObject



5
6
7
8
# File 'app/models/concerns/foreman_spacewalk/hostgroup_extensions.rb', line 5

def spacewalk_proxy
  return super unless ancestry.present?
  SmartProxy.find_by_id(inherited_spacewalk_proxy_id)
end