Project

General

Profile

Actions

Bug #38205

open

Orphan deletion fails with "The repository version cannot be deleted because it (or its publications) are currently being used to distribute content. Please update the necessary distributions first."

Added by dstephens1980 please_edit_me 8 days ago. Updated 7 days ago.

Status:
Need more information
Priority:
Normal
Assignee:
-
Category:
-
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

Specs:
OS - EL8
CPU - 4 core
RAM - 20GB
Storage - 1TB for /var
Foreman - 3.11.0
Katello - 4.13.0
Pulpcore - 2.0.1

Issue:
CLI execution of "foreman-rake katello:delete_orphaned_content" starts the expected cleanup task which then fails with "The repository version cannot be deleted because it (or its publications) are currently being used to distribute content. Please update the necessary distributions first."

Expectation:
Orphaned content is cleaned off disk

Notes:
We do NOT use Content Views, all client machines use the Default Content View from the Library. This was done as we could find no way to automate creation/publication of a Content View every time a repo was sync'd. Since the Default View does auto-update after a repository sync we simply use that, so there is no "distribution" to update. Thinking more about this it might be expected behavior and if so don't hesitate to tear me a new one :) Please let me know if I need to clarify or provide more data.

Actions #1

Updated by Ian Ballou 7 days ago ยท Edited

  • Status changed from New to Need more information

Hi there,

Pulp somewhat recently stopped users from deleting repository versions that are distributed via Pulp distributions. Katello is supposed to know all repository versions that are being distributed, and so this bug technically should not be hit unless a task fails or if Pulp is being used outside of Katello (like for hosting your own separate repos). Katello assumes it has complete control of Pulp.

With that said, to help you out, we can assist in finding the extra distribution that you need to delete. Then orphan cleanup should work just fine.

1. Open up the foreman console via `foreman-rake console`.
2. Run

PulpcoreClient::DistributionsApi.new(PulpcoreClient::ApiClient.new(SmartProxy.pulp_primary.pulp3_configuration(PulpcoreClient::Configuration))).list(per_page: 1000).results.map(&:pulp_href) - ::Katello::Pulp3::DistributionReference.select(:href).pluck(:href)

-> The output should be all of the Pulp distributions that Katello does not know. There is likely one that looks like `/pulp/api/v3/distributions/core/artifacts/.../` that shouldn't be deleted since it's for contentguard, which should not be causing your error here.

4. Inspect each href using `sudo pulp show --href <href>` to make sure it doesn't look like anything you need.
5. If it looks extra, delete it:

sudo pulp --force <rpm/container/file/etc> destroy --href <href>

6. Repeat step (5) for any remaining hrefs that Katello does not know about.

If you need more help, I might suggest we take this conversation to https://community.theforeman.org/tags/c/support/10/katello

Actions

Also available in: Atom PDF