Module: Katello::Concerns::HostManagedExtensions::ClassMethods

Defined in:
app/models/katello/concerns/host_managed_extensions.rb

Instance Method Summary collapse

Instance Method Details

#find_by_installed_debs(_key, _operator, value) ⇒ Object



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'app/models/katello/concerns/host_managed_extensions.rb', line 220

def find_by_installed_debs(_key, _operator, value)
  name, architecture, version = Katello::Deb.split_nav(value)
  debs = Katello::InstalledDeb.where(:name => name)
  debs = debs.where(:architecture => architecture) unless architecture.nil?
  debs = debs.where(:version => version) unless version.nil?
  hosts = debs.joins(:host_installed_debs).select("#{Katello::HostInstalledDeb.table_name}.host_id as host_id").pluck(:host_id)
  if hosts.empty?
    {
      :conditions => "1=0"
    }
  else
    {
      :conditions => "#{::Host::Managed.table_name}.id IN (#{hosts.join(',')})"
    }
  end
end