Project

Profile

Help

Story #5008

As a user, I can enforce content specific uniqueness constaints in a repo version

Added by ttereshc 4 months ago. Updated 12 days ago.

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

100%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:
Sprint 60

Description

RemoveDuplicates stage provides the opportunity to enforce uniqueness constraints for content at the sync time.
The duplicate problem can be encountered at any time content is added to a repository, not only at sync time.
E.g. Content was uploaded, or content was synced as a part of other repo, and now it's added/copied to a new repository.

It would be good if some check/validation happened for any added content, e.g. at this stage

Examples for where uniqueness might be needed in a repo version:
- only one content unit with a certain characteristics should be present in a repo (only one advisory with the same id, only one module_defaults for a module, etc)

This issue was discussed on this thread: https://www.redhat.com/archives/pulp-dev/2019-May/msg00061.html

Solution

Plugins:
On the plugin content model define a repo_key - one or more fields which must be unique within a repo version.

Pulpcore:
Check uniqueness of the repo_key for each added content type at the repository version creation time https://github.com/pulp/pulpcore/blob/aef490e201f89fc005ba3239fda3a79c05e28fd7/pulpcore/app/models/repository.py#L343.
Whether it's sync, copy, or upload, repo_key uniqueness will be ensured if core/plugin devs use with RepositoryVersion.create(...) context manager.


Related issues

Related to File Support - Task #4028: Prevent duplicate files in repositories MODIFIED Actions
Related to RPM Support - Story #4898: As a user, no "duplicated" content is present in a repo version NEW Actions

Associated revisions

Revision c2be7fcb View on GitHub
Added by bmbouter 13 days ago

Add release note for changes in pulpcore

The feature is actually in pulpcore's code, but the release note needs
to be in this package, which imports it.

Related PR: https://github.com/pulp/pulpcore/pull/331

https://pulp.plan.io/issues/5008
closes #5008

Revision b41a0923 View on GitHub
Added by bmbouter 13 days ago

Add repo_key support for `add_content`

The `Content` model now supports a `repo_key` attribute which defaults
to (). Plugin writers can specify this, and the tuple field names will
automatically replace another unit of the same type with these field
names.

Required PR: https://github.com/pulp/pulp_file/pull/290

https://pulp.plan.io/issues/5008
closes #5008

History

#1 Updated by ttereshc 4 months ago

  • Description updated (diff)

#2 Updated by ttereshc 4 months ago

  • Related to Task #4028: Prevent duplicate files in repositories added

#3 Updated by ttereshc 4 months ago

  • Related to Story #4898: As a user, no "duplicated" content is present in a repo version added

#4 Updated by amacdona@redhat.com 4 months ago

  • Triaged changed from No to Yes

#5 Updated by ttereshc 3 months ago

  • Description updated (diff)

#6 Updated by ttereshc 3 months ago

  • Description updated (diff)

#7 Updated by amacdona@redhat.com 3 months ago

  • Sprint set to Sprint 56

#8 Updated by bmbouter 3 months ago

This all looks good. Should we convert this to a story? To me in the changelog this would make the most sense as a new feature in the pulpcore-plugin package. What do you think?

#9 Updated by ttereshc 3 months ago

  • Tracker changed from Issue to Story
  • Subject changed from No way to enforce content specific uniqueness constaints in a repo version to As a user, I can enforce content specific uniqueness constaints in a repo version
  • % Done set to 0

#10 Updated by bmbouter 3 months ago

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

This looks good to me. Thank you for recapping @ttereshc!

#11 Updated by rchan 3 months ago

  • Sprint changed from Sprint 56 to Sprint 57

#12 Updated by rchan about 2 months ago

  • Sprint changed from Sprint 57 to Sprint 58

#13 Updated by bmbouter about 1 month ago

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

#14 Updated by rchan about 1 month ago

  • Sprint changed from Sprint 58 to Sprint 59

#15 Updated by daviddavis 24 days ago

  • Sprint/Milestone set to 3.0

#16 Updated by rchan 24 days ago

  • Sprint changed from Sprint 59 to Sprint 60

#17 Updated by bmbouter 13 days ago

  • Status changed from ASSIGNED to POST

#18 Updated by bmbouter 12 days ago

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

Please register to edit this issue

Also available in: Atom PDF