Module: Katello::Util::Errata
- Included in:
- Pulp3::Repository::Yum
- Defined in:
- app/lib/katello/util/errata.rb
Instance Method Summary collapse
- #filter_by_state(errata_list, errata_state) ⇒ Object
- #filter_by_type(errata_list, filter_type) ⇒ Object
- #filter_errata_by_pulp_href(errata, content_pulp_hrefs, source_repo_rpm_filenames, source_repo_module_stream_specs) ⇒ Object
- #get_pulp_filter_type(type) ⇒ Object
Instance Method Details
#filter_by_state(errata_list, errata_state) ⇒ Object
41 42 43 44 45 46 47 |
# File 'app/lib/katello/util/errata.rb', line 41 def filter_by_state(errata_list, errata_state) if errata_state == "applied" return [] else return errata_list end end |
#filter_by_type(errata_list, filter_type) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/lib/katello/util/errata.rb', line 6 def filter_by_type(errata_list, filter_type) filtered_list = [] if filter_type != "All" pulp_filter_type = get_pulp_filter_type(filter_type) errata_list.each do |erratum| if erratum.respond_to?(:type) if erratum.type == pulp_filter_type filtered_list << erratum end else if erratum["type"] == pulp_filter_type filtered_list << erratum end end end else filtered_list = errata_list end return filtered_list end |
#filter_errata_by_pulp_href(errata, content_pulp_hrefs, source_repo_rpm_filenames, source_repo_module_stream_specs) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'app/lib/katello/util/errata.rb', line 49 def filter_errata_by_pulp_href(errata, content_pulp_hrefs, source_repo_rpm_filenames, source_repo_module_stream_specs) return [] if content_pulp_hrefs.empty? source_repo_rpm_filenames = source_repo_rpm_filenames.map { |rpm| File.basename(rpm) } rpm_filenames = Katello::Rpm.where(:pulp_id => content_pulp_hrefs).map { |rpm| File.basename(rpm.filename) } srpm_filenames = Katello::Srpm.where(:pulp_id => content_pulp_hrefs).map { |srpm| File.basename(srpm.filename) } module_stream_specs = Katello::ModuleStream.where(:pulp_id => content_pulp_hrefs).map(&:module_spec) matching_errata = [] errata.each do |erratum| # The erratum should be copied if content_pulp_hrefs has all of its packages/modules that are available in the source repo. content_in_erratum_and_source_repo = (erratum.packages.pluck(:filename) + erratum.module_stream_specs) & (source_repo_rpm_filenames + source_repo_module_stream_specs) if (content_in_erratum_and_source_repo - rpm_filenames - srpm_filenames - module_stream_specs).empty? || (erratum.packages.empty? && erratum.module_streams.empty?) || content_in_erratum_and_source_repo.empty? matching_errata << erratum end end matching_errata end |
#get_pulp_filter_type(type) ⇒ Object
30 31 32 33 34 35 36 37 38 39 |
# File 'app/lib/katello/util/errata.rb', line 30 def get_pulp_filter_type(type) filter_type = type.downcase if filter_type == "bugfix" return ::Katello::Erratum::BUGZILLA elsif filter_type == "enhancement" return ::Katello::Erratum::ENHANCEMENT elsif filter_type == "security" return ::Katello::Erratum::SECURITY end end |