Module: ForemanPuppet::Extensions::HostCounter

Extended by:
ActiveSupport::Concern
Defined in:
app/services/concerns/foreman_puppet/extensions/host_counter.rb

Instance Method Summary collapse

Instance Method Details

#counted_hostsObject



6
7
8
9
10
11
12
13
14
# File 'app/services/concerns/foreman_puppet/extensions/host_counter.rb', line 6

def counted_hosts
  case @association.to_s
  when 'environment'
    hosts_scope = ::Host::Managed.reorder('').joins(:puppet)
    hosts_scope.authorized(:view_hosts).group(HostPuppetFacet.arel_table[:environment_id]).count
  else
    super
  end
end