Class: Katello::ContentViewPackageFilter

Inherits:
ContentViewFilter show all
Defined in:
app/models/katello/content_view_package_filter.rb

Constant Summary collapse

CONTENT_TYPE =
Rpm::CONTENT_TYPE

Constants inherited from ContentViewFilter

Katello::ContentViewFilter::CONTENT_OPTIONS, Katello::ContentViewFilter::CONTENT_TYPES, Katello::ContentViewFilter::ERRATA, Katello::ContentViewFilter::PACKAGE_GROUP, Katello::ContentViewFilter::RPM

Instance Method Summary collapse

Methods inherited from ContentViewFilter

applicable, #applicable_repos, #as_json, class_for, #content_type, create_for, #filter_type, #params_format, #resulting_products, rule_class_for, rule_ids_for, #validate_content_view, #validate_filter_repos, yum

Methods inherited from Model

#destroy!

Instance Method Details

#generate_clauses(repo) ⇒ Array

Returns a set of Pulp/MongoDB conditions to filter out packages in the repo repository that match parameters

Parameters:

  • repo (Repository)

    a repository containing packages to filter

Returns:

  • (Array)

    an array of hashes with MongoDB conditions



14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/models/katello/content_view_package_filter.rb', line 14

def generate_clauses(repo)
  package_filenames = []

  self.package_rules.each do |rule|
    package_filenames.concat(query_rpms(repo, rule))
  end
  if self.original_packages
    package_filenames.concat(repo.packages_without_errata.map(&:filename))
  end

  { 'filename' => { "$in" => package_filenames } } unless package_filenames.empty?
end

#original_packages=(value) ⇒ Object



27
28
29
# File 'app/models/katello/content_view_package_filter.rb', line 27

def original_packages=(value)
  self[:original_packages] = value
end