#3208 hub: improve inheritance priority collision error message
Merged by tkopecek. Opened by ktdreyer.
ktdreyer/koji multiple-priority-error  into  master

Download 3208.patch

When users set multiple parents to the same priority in setInheritanceData(), we raise an error because this is an invalid configuration.

Improve the error message to make it easier for humans to understand the problem and explain which tag ID ints are parents or children.

Here's how I tested this:

import koji
from koji_cli.lib import activate_session
mykoji = koji.get_profile_module('kojidev')  # my local koji hub
opts = vars(mykoji.config)
session = mykoji.ClientSession(mykoji.config.server, opts)
activate_session(session, session.opts)
assert session.logged_in
child_tag = 'example-child' # an example child tag I created on my local hub
new_rules = [
 {'parent_id': 37,  # an example parent tag I created
  'intransitive': False,
  'maxdepth': None,
  'noconfig': False,
  'pkg_filter': '',
  'priority': 10},
 {'parent_id': 41, # another example parent tag I created
  'intransitive': False,
  'maxdepth': None,
  'noconfig': False,
  'pkg_filter': '',
  'priority': 10},  # Note this is the same priority as above, to trigger an error on the hub
]
session.setInheritanceData(child_tag, new_rules, clear=True)

@ktdreyer flake8 is failing on line length here.

Commit ba407086 fixes this pull-request

Pull-Request has been merged by tkopecek

Metadata