#4503 add-group and add-group-pkg (API groupListAdd) do not add a a new group if one is already inherited
Opened by cobrien. Modified

# Start out with a base tag with some packages in a single group
[koji@d88cd885b845 ~]$ koji call getTagGroups example-1
[{'biarchonly': False,
  'blocked': False,
  'description': None,
  'display_name': 'build',
  'exported': True,
  'group_id': 2,
  'grouplist': [],
  'is_default': None,
  'langonly': None,
  'name': 'build',
  'packagelist': [{'basearchonly': None,
                   'blocked': False,
                   'group_id': 2,
                   'package': 'beer',
                   'requires': None,
                   'tag_id': 38,
                   'type': 'mandatory'},
                  {'basearchonly': None,
                   'blocked': False,
                   'group_id': 2,
                   'package': 'tacos',
                   'requires': None,
                   'tag_id': 38,
                   'type': 'mandatory'},
                  {'basearchonly': None,
                   'blocked': False,
                   'group_id': 2,
                   'package': 'pizza',
                   'requires': None,
                   'tag_id': 38,
                   'type': 'mandatory'}],
  'tag_id': 38,
  'uservisible': True}]
# Add a child tag, and try to *explicitly* add the same build group.
[koji@d88cd885b845 ~]$ koji add-tag example-4 --parent example-1
[koji@d88cd885b845 ~]$ koji call groupListAdd example-4 build force=True
None
# And add a package to the group
[koji@d88cd885b845 ~]$ koji add-group-pkg example-4 build cookies
# But it's not there from the API!
[koji@d88cd885b845 ~]$ koji call getTagGroups example-4 inherit=False
[]
# Removing the inheritance link means the group isn't present at all
[koji@d88cd885b845 ~]$ koji remove-tag-inheritance example-4 example-1
[koji@d88cd885b845 ~]$ koji call getTagGroups example-4 inherit=False
[]
# But with no inheritance link, we can actually add it this time
[koji@d88cd885b845 ~]$ koji call groupListAdd example-4 build force=True
None
# Group packages appear
[koji@d88cd885b845 ~]$ koji call getTagGroups example-4 inherit=False
[{'biarchonly': False,
  'blocked': False,
  'description': None,
  'display_name': 'build',
  'exported': True,
  'group_id': 2,
  'grouplist': [],
  'is_default': None,
  'langonly': None,
  'name': 'build',
  'packagelist': [{'basearchonly': None,
                   'blocked': False,
                   'group_id': 2,
                   'package': 'cookies',
                   'requires': None,
                   'tag_id': 41,
                   'type': 'mandatory'}],
  'tag_id': 41,
  'uservisible': True}]
# And if we add the inheritance link back in, we can still see the groups
[koji@d88cd885b845 ~]$ koji add-tag-inheritance example-4 example-1
[koji@d88cd885b845 ~]$ koji call getTagGroups example-4 inherit=False
[{'biarchonly': False,
  'blocked': False,
  'description': None,
  'display_name': 'build',
  'exported': True,
  'group_id': 2,
  'grouplist': [],
  'is_default': None,
  'langonly': None,
  'name': 'build',
  'packagelist': [{'basearchonly': None,
                   'blocked': False,
                   'group_id': 2,
                   'package': 'cookies',
                   'requires': None,
                   'tag_id': 41,
                   'type': 'mandatory'}],
  'tag_id': 41,
  'uservisible': True}]

Workaround for now is to call getTagGroups without setting inherit=False and then filter the results in the client application based on the tag_id value in the individual packagelist entries.

This issue has been migrated to Fedora Forge:
https://forge.fedoraproject.org/koji/koji/issues/4503

Please continue any further discussion there.

Metadata