Project

Profile

Help

Story #5008

closed

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

Added by ttereshc almost 5 years ago. Updated over 4 years 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 60
Quarter:

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 repositoriesCLOSED - CURRENTRELEASEbmbouter

Actions
Related to RPM Support - Story #4898: As a user, no "duplicated" content is present in a repo versionCLOSED - CURRENTRELEASEttereshc

Actions

Also available in: Atom PDF