#2782 Be tolerant with duplicate parents in _writeInheritanceData
Merged a year ago by tkopecek. Opened a year ago by julian8628.
julian8628/koji issue/2614  into  master

file modified
+1 -8
@@ -710,8 +710,6 @@ 

      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 @@ 

              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 @@ 

          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


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 could be avoided.

fixes: #2614
relates: #1434
relates: #1435

Metadata Update from @julian8628:
- Pull-request tagged with: testing-ready

a year ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

a year ago

Commit 5c40091 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago