Sha256: 8a68c3f8b1f8f0ec83dadcf230db36622136d016c22256c80b13a9a2e7b63fa5

Contents?: true

Size: 1.12 KB

Versions: 161

Compression:

Stored size: 1.12 KB

Contents

module Actions
  module Katello
    module Product
      class ContentDestroy < Actions::Base
        def plan(root_repository)
          fail _("Cannot delete redhat product content") if root_repository.product.redhat?
          sequence do
            plan_action(Candlepin::Product::ContentRemove,
                        owner: root_repository.product.organization.label,
                        product_id: root_repository.product.cp_id,
                        content_id: root_repository.content_id)

            katello_content_id = root_repository.content&.id
            ::Katello::ProductContent.where(product_id: root_repository.product_id,
                                            content_id: katello_content_id).destroy_all

            if root_repository.repositories.count <= 1
              plan_action(Candlepin::Product::ContentDestroy,
                          owner: root_repository.product.organization.label,
                          content_id: root_repository.content_id)

              ::Katello::Content.find_by_id(katello_content_id)&.destroy!
            end
          end
        end
      end
    end
  end
end

Version data entries

161 entries across 161 versions & 1 rubygems

Version Path
katello-4.14.3 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.2 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.1 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.0 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.0.rc3 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.0.rc1.1 app/lib/actions/katello/product/content_destroy.rb
katello-4.14.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-4.13.1 app/lib/actions/katello/product/content_destroy.rb
katello-4.13.0 app/lib/actions/katello/product/content_destroy.rb
katello-4.12.1 app/lib/actions/katello/product/content_destroy.rb
katello-4.13.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-4.12.0 app/lib/actions/katello/product/content_destroy.rb
katello-4.12.0.rc3 app/lib/actions/katello/product/content_destroy.rb
katello-4.12.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-4.12.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-4.11.1 app/lib/actions/katello/product/content_destroy.rb
katello-4.11.0 app/lib/actions/katello/product/content_destroy.rb
katello-4.11.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-4.11.0.rc1 app/lib/actions/katello/product/content_destroy.rb