Sha256: 0c4bc889bf4e0eda7af0548de3a27ce7361bc016dbe9c21e7c738a70f8399e4f

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 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(katello_content_id)&.destroy!
            end
          end
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
katello-3.11.2 app/lib/actions/katello/product/content_destroy.rb
katello-3.10.2 app/lib/actions/katello/product/content_destroy.rb
katello-3.12.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.12.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.10.1.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.12.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-3.10.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.11.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.11.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.11.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.11.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-3.10.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.10.0.rc1.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.9.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.10.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-3.9.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.9.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.9.0.rc1 app/lib/actions/katello/product/content_destroy.rb