5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/lib/actions/katello/product/content_destroy.rb', line 5
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
|