Sha256: 0297f74765c091ea36d3e896c5b08ae4848d98e568f68ba70b6d4f4634db8047

Contents?: true

Size: 1.13 KB

Versions: 14

Compression:

Stored size: 1.13 KB

Contents

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

            katello_content_id = repository.product.product_content_by_id(repository.content_id).content_id

            ::Katello::ProductContent.where(product_id: repository.product_id,
                                            content_id: katello_content_id).destroy_all

            if repository.other_repos_with_same_content.empty?
              plan_action(Candlepin::Product::ContentDestroy,
                          owner: repository.product.organization.label,
                          content_id: repository.content_id)

              ::Katello::Content.find(katello_content_id).destroy!
            end
          end
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
katello-3.8.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.7.1.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.7.1 app/lib/actions/katello/product/content_destroy.rb
katello-3.8.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.8.0.rc3 app/lib/actions/katello/product/content_destroy.rb
katello-3.8.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.7.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.8.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-3.7.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.7.0.rc1 app/lib/actions/katello/product/content_destroy.rb
katello-3.6.0 app/lib/actions/katello/product/content_destroy.rb
katello-3.6.0.1.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.6.0.rc2 app/lib/actions/katello/product/content_destroy.rb
katello-3.6.0.rc1 app/lib/actions/katello/product/content_destroy.rb