Project

Profile

Help

Issue #9503

Updated by ttereshc about 3 years ago

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](https://github.com/pulp/pulp_rpm/blob/3.15.0/pulp_rpm/app/advisory.py#L75) 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](https://github.com/pulp/pulp_rpm/blob/3.15.0/pulp_rpm/app/advisory.py#L88) 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.

Back