Test parent tag existence before query for its id

If client called:
    $ koji add-tag new-tag-name --parent nonexistent-tag

it failed with error:

    xmlrpclib.Fault: <Fault 1: 'exceptions.TypeError: unsubscriptable
    object'>
This commit is contained in:
Pavol Babincak 2014-12-16 09:48:02 -05:00 committed by Mike McLean
parent cd45e886cc
commit 07ea07f875

View file

@ -2718,9 +2718,9 @@ def create_tag(name, parent=None, arches=None, perm=None, locked=False, maven_su
# Does the parent exist?
if parent:
parent_tag = get_tag(parent)
parent_id = parent_tag['id']
if not parent_tag:
raise koji.GenericError("Parent tag '%s' could not be found" % parent)
parent_id = parent_tag['id']
else:
parent_id = None