Sha256: 7a0556d430fc44f80b95af87fd086567ade3b86f1479601cb780900b48fe0da4

Contents?: true

Size: 807 Bytes

Versions: 13

Compression:

Stored size: 807 Bytes

Contents

module Actions
  module Pulp
    module Repository
      class PurgeEmptyErrata < Pulp::AbstractAsyncTask
        input_format do
          param :pulp_id, Integer
        end

        def invoke_external_task
          repo = ::Katello::Repository.where(:pulp_id => input[:pulp_id]).first

          package_lists = repo.package_lists_for_publish
          filenames = package_lists[:filenames]

          errata_to_delete = repo.errata.collect do |erratum|
            erratum.errata_id if filenames.intersection(erratum.packages.pluck(:filename)).empty?
          end
          errata_to_delete.compact!
          repo.unassociate_by_filter(::Katello::ContentViewErratumFilter::CONTENT_TYPE,
                                 "id" => { "$in" => errata_to_delete })
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
katello-2.4.5 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.4 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.3 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.2 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-3.0.0.rc4 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-3.0.0.rc3 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-3.0.0.rc2 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-3.0.0.rc1 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.1 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.0 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.0.rc3 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.0.rc2 app/lib/actions/pulp/repository/purge_empty_errata.rb
katello-2.4.0.rc1 app/lib/actions/pulp/repository/purge_empty_errata.rb