Class: Katello::ContentViewPackageGroupFilter

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

Constant Summary collapse

CONTENT_TYPE =
PackageGroup::CONTENT_TYPE

Constants inherited from ContentViewFilter

Katello::ContentViewFilter::CONTENT_OPTIONS, Katello::ContentViewFilter::CONTENT_TYPES, Katello::ContentViewFilter::DEB, Katello::ContentViewFilter::DOCKER, Katello::ContentViewFilter::ERRATA, Katello::ContentViewFilter::MODULE_STREAM, 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, deb, docker, errata, #filter_type, module_stream, #original_module_streams=, #original_packages=, #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

#content_unit_pulp_ids(repo) ⇒ Object



15
16
17
18
19
20
# File 'app/models/katello/content_view_package_group_filter.rb', line 15

def content_unit_pulp_ids(repo)
  package_group_hrefs = package_group_rules.reject { |rule| rule.uuid.blank? }.flat_map.map(&:uuid)
  package_group_names = repo.package_groups.
    where(:pulp_id => package_group_hrefs).collect { |package_group| package_group.package_names }.flatten.uniq
  repo.rpms.where(:name => package_group_names).pluck(:pulp_id).compact
end

#generate_clauses(_repo) ⇒ Object



10
11
12
13
# File 'app/models/katello/content_view_package_group_filter.rb', line 10

def generate_clauses(_repo)
  package_group_ids = package_group_rules.reject { |rule| rule.uuid.blank? }.flat_map.map(&:uuid)
  { "_id" => { "$in" => package_group_ids } } unless package_group_ids.empty?
end