Project

Profile

Help

Backport #9519

closed

Backport #9503 "get() returned more than one UpdateRecord -- it returned X!" to 3.14.z

Added by ttereshc about 3 years ago. Updated about 3 years ago.

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

100%

Estimated time:
Triaged:
No
Sprint Candidate:
No
Tags:
Katello
Sprint:
Sprint 107
Quarter:

Description

Advisory conflict resolution doesn't properly support the case when multiple advisories with the same errata_id but different in some other way are added to a repository version or somehow existed in previous repo version.

pulp [59cc0e4d-b1d3-4e83-be25-a010e9413044]: pulpcore.tasking.pulpcore_worker:INFO: Task 1584fe74-28d1-4d63-9710-b1b4e36a6e1c failed (get() returned more than one UpdateRecord -- it returned 2!) 
pulp [59cc0e4d-b1d3-4e83-be25-a010e9413044]: pulpcore.tasking.pulpcore_worker:INFO:   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_rpm/app/models/repository.py", line 353, in finalize_new_version
resolve_advisories(new_version, previous_version)
File "/usr/lib/python3.6/site-packages/pulp_rpm/app/advisory.py", line 87, in resolve_advisories
previous_advisory = previous_advisories.get(id=advisory_id)
File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 412, in get
(self.model._meta.object_name, num)


pulp [59cc0e4d-b1d3-4e83-be25-a010e9413044]: pulpcore.tasking.pulpcore_worker:INFO: Task e9a64af6-047f-48d6-825d-48108e9e3c26 failed (get() returned more than one UpdateRecord -- it returned 2!) 
pulp [59cc0e4d-b1d3-4e83-be25-a010e9413044]: pulpcore.tasking.pulpcore_worker:INFO:   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_rpm/app/models/repository.py", line 353, in finalize_new_version
resolve_advisories(new_version, previous_version)
File "/usr/lib/python3.6/site-packages/pulp_rpm/app/advisory.py", line 88, in resolve_advisories
added_advisory = UpdateRecord.objects.get(id=advisory_id, pk__in=added_advisory_pks)
File "/usr/lib/python3.6/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/usr/lib/python3.6/site-packages/django/db/models/query.py", line 412, in get
(self.model._meta.object_name, num)

Currently, there is a check for adding exactly the same advisory multiple times. It doesn't cover the case when it's different versions of the same advisory.

So it is possible to fail here when two different advisories but with the same errata_id are being added.

To reproduce, use modify/ endpoint and pass two different advisories with the same errata_id.


Related issues

Copied from RPM Support - Issue #9503: get() returned more than one UpdateRecord -- it returned X!CLOSED - CURRENTRELEASEttereshcActions
Actions #1

Updated by ttereshc about 3 years ago

  • Copied from Issue #9503: get() returned more than one UpdateRecord -- it returned X! added
Actions #2

Updated by ttereshc about 3 years ago

  • Sprint/Milestone set to 3.14.7
Actions #3

Updated by pulpbot about 3 years ago

  • Status changed from NEW to POST

Added by ttereshc about 3 years ago

Revision 72c313a8 | View on GitHub

Advisory conflict resolution backports.

backports #9503 https://pulp.plan.io/issues/9503

fixes #9519

(cherry picked from commit d519d9ab504a1e37b6e4405300f85641122b4a81)

Actions #4

Updated by ttereshc about 3 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #5

Updated by pulpbot about 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF