From bcece35a21826cfcefb14130c44ed5de42da3900 Mon Sep 17 00:00:00 2001 From: Mike McLean Date: May 22 2019 18:57:17 +0000 Subject: PR#1255: always check existence of tag in setInheritanceData Merges #1255 https://pagure.io/koji/pull-request/1255 Fixes: #1252 https://pagure.io/koji/issue/1252 setInheritanceData raise Fault for non-existing tag id --- diff --git a/hub/kojihub.py b/hub/kojihub.py index 8353205..958164a 100644 --- a/hub/kojihub.py +++ b/hub/kojihub.py @@ -712,6 +712,8 @@ def _writeInheritanceData(tag_id, changes, clear=False): " 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 data = dict([[link['parent_id'], link] for link in readInheritanceData(tag_id)]) for link in changes: @@ -10175,9 +10177,8 @@ class RootExports(object): apply the ones you submit here. If unspecified, this defaults to False. """ - if not isinstance(tag, six.integer_types): - #lookup tag id - tag = get_tag_id(tag, strict=True) + # verify existence of tag and/or convert name to id + tag = get_tag_id(tag, strict=True) context.session.assertPerm('admin') return writeInheritanceData(tag, data, clear=clear)