Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a good way to deal with "protected" repository version deletions #5218

Open
sjha4 opened this issue Apr 3, 2024 · 2 comments
Open
Labels

Comments

@sjha4
Copy link

sjha4 commented Apr 3, 2024

Is your feature request related to a problem? Please describe.
Following the changes here: c4e842c , we can no longer delete repo versions if it's distributed (directly or via publication)

We are looking at a workflow during Katello initiated orphan cleanup, where we have a list of repo versions we want to delete. We send a request to delete those and we get an error message : The repository version cannot be deleted because it (or its publications) are currently being used to distribute content. Please update the necessary distributions first.

Describe the solution you'd like

Some enhancements around this which would help out greatly are the ability to list all distros/publications that are tied to a repo version. Today the way to do so via API would be to fetch publications for the version and then distros for the publication. It would be nice to have an API call to fetch these with a list of versions.

Furthermore, for types that skip publications and distribute versions directly, ex: container/ansible collections, I was looking for a good way to fetch distros ties to a version..The list API doesn't seem to support searching on repo_versions: https://docs.pulpproject.org/pulp_container/restapi.html#tag/Distributions:-Container/operation/distributions_container_container_list or https://docs.pulpproject.org/pulp_ansible/en/master/nightly/restapi.html#tag/Distributions:-Ansible/operation/distributions_ansible_ansible_list

Also, When an exception is thrown when deleting protected version, it will also be useful to list the resources (publication/distributions) that caused the exception in the error message.

Describe alternatives you've considered
An alternative would be to allow cascading delete of a repo version that would in turn delete ny distributions tied to it.

Additional context

@ipanova
Copy link
Member

ipanova commented Apr 9, 2024

In the code we already identify what publications/distributions the repo_version is tied to. Can we just add to the error message list of hrefs?

@sjha4
Copy link
Author

sjha4 commented Apr 9, 2024

That would be useful. I was also thinking of API support to filter distributions by repo versions. I don't think that filter exists on APIs of most plugins if any. ex: rpm : https://docs.pulpproject.org/pulp_rpm/restapi.html#tag/Distributions:-Rpm/operation/distributions_rpm_rpm_list

The point would be to be able to query any such distributions and deleting them before deleting the protected version to avoid the validation error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants