#1434 hub: fix check_fields and duplicated parent_id in _writeInheritanceData
Merged 4 years ago by mikem. Opened 4 years ago by julian8628.
julian8628/koji fix-writeInheritanceData  into  master

file modified
+9 -1
@@ -682,13 +682,21 @@ 

      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'):

              check_fields = ('parent_id')

-         for f in fields:

+         for f in check_fields:

              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)

      # read current data and index

      data = dict([[link['parent_id'], link] for link in readInheritanceData(tag_id)])

      for link in changes:

1 new commit added

  • check duplicated parent_id in changes
4 years ago

Commit fc0f127 fixes this pull-request

Pull-Request has been merged by mikem

4 years ago

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

4 years ago