Module: Katello::Util::PulpcoreContentFilters

Included in:
Pulp3::Repository::Yum
Defined in:
app/lib/katello/util/pulpcore_content_filters.rb

Instance Method Summary collapse

Instance Method Details

#filter_distribution_trees_by_pulp_hrefs(distributiontree_results, _content_pulp_hrefs) ⇒ Object



4
5
6
# File 'app/lib/katello/util/pulpcore_content_filters.rb', line 4

def filter_distribution_trees_by_pulp_hrefs(distributiontree_results, _content_pulp_hrefs)
  distributiontree_results.collect { |result| result.pulp_href }.flatten.uniq
end

#filter_metadatafiles_by_pulp_hrefs(metadatafiles_results, _package_pulp_hrefs) ⇒ Object



29
30
31
# File 'app/lib/katello/util/pulpcore_content_filters.rb', line 29

def filter_metadatafiles_by_pulp_hrefs(metadatafiles_results, _package_pulp_hrefs)
  metadatafiles_results.collect { |result| result.pulp_href }.flatten.uniq
end

#filter_package_environments_by_pulp_hrefs(packageenvironment_results, package_pulp_hrefs) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'app/lib/katello/util/pulpcore_content_filters.rb', line 17

def filter_package_environments_by_pulp_hrefs(packageenvironment_results, package_pulp_hrefs)
  matching_package_env_groups = []

  packageenvironment_results.each do |result|
    if (result.packagegroups & package_pulp_hrefs).any?
      matching_package_env_groups << result.pulp_href
    end
  end

  matching_package_env_groups.flatten.uniq
end

#filter_package_groups_by_pulp_href(package_groups, package_pulp_hrefs) ⇒ Object



8
9
10
11
12
13
14
15
# File 'app/lib/katello/util/pulpcore_content_filters.rb', line 8

def filter_package_groups_by_pulp_href(package_groups, package_pulp_hrefs)
  rpms = Katello::Rpm.where(:pulp_id => package_pulp_hrefs)
  package_groups.reject do |package_group|
    #copy the package group as long as we have 1 package from the group
    package_group.package_names.empty? ||
    (package_group.package_names & rpms.pluck(:name)).empty?
  end
end