Project

Profile

Help

Story #8454

As a user, I can't delete RepositoryVersion.number==0

Added by bmbouter 4 months ago. Updated 4 months ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Sprint:
Sprint 94
Quarter:

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

  1. The viewset should no longer prevent that RepositoryVersion 0 can be removed
  2. 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
  3. Add tests (see below)

Add Tests

We need a functional test asserting the correctness around removing RepoVersion 0. Something like:

  1. Create a repository
  2. Put some content in it to create RepoVersion 1
  3. Put more content in it to create RepoVersion 2
  4. Assert the content counts for RepositoryVersion 2
  5. Assert the content summary data from RepoVersion 2
  6. Delete RepoVersion 0
  7. Delete RepoVersion 1
  8. Assert the content counts from RepoVersion 2 again, to ensure the content is still in-tact.
  9. 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.

  1. Create a Repository
  2. Try to delete repository 0
  3. Assert the task fails.

Related issues

Blocks Pulp - Story #8368: Limit number of old repository versions.CLOSED - CURRENTRELEASE

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 2d5abaa7 View on GitHub
Added by daviddavis 4 months ago

Allow users to delete repo version 0

fixes #8454

History

#1 Updated by daviddavis 4 months ago

  • Blocks Story #8368: Limit number of old repository versions. added

#2 Updated by jsherril@redhat.com 4 months 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?

#3 Updated by ggainey 4 months 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.

#4 Updated by fao89 4 months ago

  • Tracker changed from Issue to Story
  • % Done set to 0
  • Severity deleted (2. Medium)
  • Triaged deleted (No)

#5 Updated by bmbouter 4 months 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.

#6 Updated by bmbouter 4 months ago

  • Description updated (diff)

#7 Updated by bmbouter 4 months ago

  • Description updated (diff)

#8 Updated by daviddavis 4 months ago

  • Groomed changed from No to Yes
  • Sprint Candidate changed from No to Yes

#9 Updated by bmbouter 4 months ago

  • Sprint/Milestone set to 3.12.0

#10 Updated by daviddavis 4 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to daviddavis

#11 Updated by mdellweg 4 months ago

  • Sprint/Milestone changed from 3.12.0 to 3.13.0

#12 Updated by pulpbot 4 months ago

  • Status changed from ASSIGNED to POST

#13 Updated by daviddavis 4 months ago

  • Sprint set to Sprint 94

#14 Updated by daviddavis 4 months ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#15 Updated by mdellweg 4 months ago

  • Sprint/Milestone changed from 3.13.0 to 3.12.0

#16 Updated by pulpbot 4 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF