The validate_duplicate_content function should provide more information in the failure case.
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 598
- Forks
- 168
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 86
Description
Author: @quba42 (quba42)
Redmine Issue: 9574, https://pulp.plan.io/issues/9574
When the validate_duplicate_content function finds illegal duplicate content in a repo version being created, the output is (pulp_deb example):
"Cannot create repository version. More than one deb.package content with the duplicate values for package, version, architecture."
For users to have any chance of debugging this situation, it would be vital for the error to provide them with a list of the offending duplicate units, preferably the pulp_href, so they can go and look at them in detail.
Without this information I just know "I have duplicate units somewhere in the potentially tens of thousands of units in the repo version being created". (Since the repo version is then not created, I can't even go hunting for the duplicate units myself...) Right now, I can't even distinguish a situation where two packages are clashing, from one where all my packages are double (for example).
User reported backtrace for the error they encountered:
File \"/usr/lib/python3.6/site-packages/pulpcore/tasking/pulpcore_worker.py\", line 317, in _perform_task
result = func(*args, **kwargs)
File \"/usr/lib/python3.6/site-packages/pulpcore/app/tasks/repository.py\", line 219, in add_and_remove
new_version.add_content(models.Content.objects.filter(pk__in=add_content_units))
File \"/usr/lib/python3.6/site-packages/pulpcore/app/models/repository.py\", line 963, in __exit__
repository.finalize_new_version(self)
File \"/usr/lib/python3.6/site-packages/pulp_deb/app/models/repository.py\", line 57, in finalize_new_version
validate_repo_version(new_version)
File \"/usr/lib/python3.6/site-packages/pulpcore/plugin/repo_version_utils.py\", line 137, in validate_repo_version
validate_duplicate_content(version)
File \"/usr/lib/python3.6/site-packages/pulpcore/plugin/repo_version_utils.py\", line 108, in validate_duplicate_content
_(\"Cannot create repository version. {msg}\").format(msg=\", \".join(error_messages))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with pulpcore/plugin/repo_version_utils.py, especially validate_duplicate_content and validate_repo_version, and review the repository finalization path shown in the backtrace. Inspect the duplicate-content failure, then make the error identify the offending duplicate units, preferably their pulp_href values. Done means users can distinguish which units conflict when repository-version creation fails.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100