From c47209926c55f1fd93d7624cb479cf5e1de98e35 Mon Sep 17 00:00:00 2001 From: Yuming Zhu Date: Mar 24 2021 10:31:21 +0000 Subject: Be tolerant with duplicate parents in _writeInheritanceData Now setInheritanceData API supports duplicate parents in data again. And we choose to clean the other fields from "delete link" items, so that the ineffective update after deletion which was reported in #1435. fixes: #2614 relates: #1434 relates: #1435 --- diff --git a/hub/kojihub.py b/hub/kojihub.py index e175415..8eee7f2 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -710,8 +710,6 @@ def _writeInheritanceData(tag_id, changes, clear=False): fields = ('parent_id', 'priority', 'maxdepth', 'intransitive', 'noconfig', 'pkg_filter') if isinstance(changes, dict): changes = [changes] - # duplicated parent_id should not be contained in changes - parent_ids = set() for link in changes: check_fields = fields if link.get('delete link'): @@ -720,11 +718,6 @@ def _writeInheritanceData(tag_id, changes, clear=False): if f not in link: raise koji.GenericError("No value for %s" % f) parent_id = link['parent_id'] - if parent_id in parent_ids: - raise koji.GenericError("Changes should not contain duplicated" - " parent_id(%i)" % parent_id) - else: - parent_ids.add(parent_id) # check existence of parent get_tag(parent_id, strict=True) # read current data and index @@ -735,7 +728,7 @@ def _writeInheritanceData(tag_id, changes, clear=False): orig = data.get(parent_id) if link.get('delete link'): if orig: - data[parent_id] = link + data[parent_id] = dslice(link, ['delete link', 'is_update', 'parent_id']) elif not orig or clear: data[parent_id] = link else: