Story #8454
closedAs a user, I can't delete RepositoryVersion.number==0
100%
Description
Current State¶
You cannot delete version 0. That is enforced int the code here.
Proposal¶
Allow users to be able to delete RepoVersion 0 if it is not the only RepoVersion. Due to the set-differencing data model in Pulp, RepositoryVersions must have at least one RepositoryVerison.
Implementation¶
- The viewset should no longer prevent that RepositoryVersion 0 can be removed
- A check needs to be added to the Delete Task that if the RepositoryVersion being deleted is the only remaining repository version an error is raised
- Add tests (see below)
Add Tests¶
We need a functional test asserting the correctness around removing RepoVersion 0. Something like:
- Create a repository
- Put some content in it to create RepoVersion 1
- Put more content in it to create RepoVersion 2
- Assert the content counts for RepositoryVersion 2
- Assert the content summary data from RepoVersion 2
- Delete RepoVersion 0
- Delete RepoVersion 1
- Assert the content counts from RepoVersion 2 again, to ensure the content is still in-tact.
- Assert the content summary data from RepoVersion 2 again, to ensure it is correct
We also need a functional test asserting that the only remaining repository version cannot be deleted.
- Create a Repository
- Try to delete repository 0
- Assert the task fails.
Related issues
Updated by daviddavis over 3 years ago
- Blocks Story #8368: Limit number of old repository versions. added
Updated by jsherril@redhat.com over 3 years ago
What if RepoVersion 0 is the only RepoVersion?
i would think a Repository should always have at least 1 version and instead of blocking deletion of version 0, we just block if there is only 1 version?
Updated by ggainey over 3 years ago
I know that at least some of our tests 'assume' that you will always get an answer from a URL like /pulp/api/v3/repositories/rpm/rpm/UUID/versions/0/
. I wouldn't block the proposal to allow /0/ to be deleted as a result, but we'll want to look very carefully to see where else that assumption might have crept into the code.
Updated by fao89 over 3 years ago
- Tracker changed from Issue to Story
- % Done set to 0
- Severity deleted (
2. Medium) - Triaged deleted (
No)
Updated by bmbouter over 3 years ago
- Subject changed from I can't delete RepositoryVersion.number==0 to As a user, I can't delete RepositoryVersion.number==0
- Description updated (diff)
I agree with comment 2. I'm revising the body to indicate that will be the behavior.
Updated by daviddavis over 3 years ago
- Groomed changed from No to Yes
- Sprint Candidate changed from No to Yes
Updated by daviddavis over 3 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to daviddavis
Updated by mdellweg over 3 years ago
- Sprint/Milestone changed from 3.12.0 to 3.13.0
Updated by pulpbot over 3 years ago
- Status changed from ASSIGNED to POST
Added by daviddavis over 3 years ago
Updated by daviddavis over 3 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulpcore|2d5abaa7987a653f0d88cb10010da14acaa225c0.
Updated by mdellweg over 3 years ago
- Sprint/Milestone changed from 3.13.0 to 3.12.0
Updated by pulpbot over 3 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Allow users to delete repo version 0
fixes #8454