Issue #5567
closedContent with duplicate repo_key_fields can be added to a repo version
Description
Steps to reproduce:
1. Create two Content with the same repo_key_fields
2. Add them to a repository with one single call
You'll end up with both in the repository, which is not valid. The problem is that the code is not checking the set of content it's adding to a repo version for duplicate repo_keys. I think the solution is to fail if there is duplicate repo_key_fields content being added to a repo version.
Related issues
Updated by daviddavis about 5 years ago
I think add_content
makes the most sense so it can fail fast. I don't have a huge preference though.
Updated by gmbnomis about 5 years ago
I agree, I think add_content
should validate its input.
Updated by gmbnomis about 5 years ago
Another option for where to implement it:
Given we have #3541, we could offer the entire repo_key
check as a generic implementation that plugins may mix in/derive from/use in their add_content
hooks.
This would simplify the add_content
implementation in RepositoryVersion.
Updated by daviddavis about 5 years ago
This is on hold until we figure https://pulp.plan.io/issues/3541 out.
Updated by bmbouter about 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to bmbouter
I'm taking as assigned so I can incorporate this fix into the delivery of 3541. https://pulp.plan.io/issues/3541
Updated by bmbouter about 5 years ago
- Status changed from ASSIGNED to NEW
- Assignee deleted (
bmbouter) - Sprint deleted (
Sprint 61)
I started working on this, but I want to pick it up after the 3.0 branch point (or release). I believe this for a few reasons:
- It's a bugfix so it can be fixed later
- it's not a blocker
- it's not a very common situation
- it should come with a test (which takes a bit more time to create)
- there is other higher prio work atm.
I'm also removing from the sprint for ^ reasons.
Updated by daviddavis almost 5 years ago
- Sprint/Milestone changed from 3.1.0 to 3.2.0
Updated by fao89 almost 5 years ago
- Description updated (diff)
- Sprint set to Sprint 66
Updated by fao89 almost 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to fao89
Updated by fao89 almost 5 years ago
seems the code is prepared to replace content based on repo_key_fields: remove_duplicates: https://github.com/pulp/pulpcore/blob/master/pulpcore/plugin/repo_version_utils.py#L16 test_second_unit_replaces_the_first: https://github.com/pulp/pulp_file/blob/master/pulp_file/tests/functional/api/test_crud_content_unit.py#L264
In [1]: repo = FileRepository.objects.first()
In [2]: repo.content.all()
Out[2]: <QuerySet [<Content (pulp_type=file.file): pk=735cbb5a-494c-4f88-9e10-2f85a2a1fb82>, <Content (pulp_type=file.file): pk=208f273c-2035-4863-834d-ecdd98789f55>]>
In [3]: [o.content for o in RepositoryVersion.objects.all()]
Out[3]:
[<QuerySet []>,
<QuerySet [<Content (pulp_type=file.file): pk=208f273c-2035-4863-834d-ecdd98789f55>]>,
<QuerySet [<Content (pulp_type=file.file): pk=735cbb5a-494c-4f88-9e10-2f85a2a1fb82>]>]
Updated by fao89 almost 5 years ago
- Status changed from ASSIGNED to POST
Updated by daviddavis almost 5 years ago
- Subject changed from Content with duplicate repo_keys can be added to a repo version to Content with duplicate repo_key_fields can be added to a repo version
- Description updated (diff)
Updated by fao89 almost 5 years ago
- Status changed from ASSIGNED to POST
Added by Fabricio Aguiar almost 5 years ago
Added by Fabricio Aguiar almost 5 years ago
Revision fc4d7868 | View on GitHub
Including test scenario
Required PR: https://github.com/pulp/pulpcore/pull/537 Content with duplicate repo_key_fields raises an error https://pulp.plan.io/issues/5567 ref #5567
Updated by Anonymous almost 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|dff17733e4e4e205f39475333b760a60b53a5e4c.
Added by Fabricio Aguiar almost 5 years ago
Revision fd3a2ae9 | View on GitHub
Duplicate repo_key_fields raises an error
https://pulp.plan.io/issues/5567 closes #5567
(cherry picked from commit dff17733e4e4e205f39475333b760a60b53a5e4c)
Updated by Anonymous almost 5 years ago
Applied in changeset pulpcore|fd3a2ae9e9244e8bc50492daf7df3da17105ac5d.
Updated by bmbouter almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Updated by bmbouter almost 5 years ago
- Sprint/Milestone changed from 3.2.0 to 3.1.1
Updated by daviddavis almost 5 years ago
- Related to Issue #6229: Syncing both Fedora 30 and Fedora 31 modular repos into Pulp (different repos) will cause the later sync to fail added
Updated by ttereshc almost 5 years ago
- Related to Issue #6362: Check for duplicated content happens without plugin input added
Duplicate repo_key_fields raises an error
https://pulp.plan.io/issues/5567 closes #5567