[PATCH] Test parent tag existence before query for its id

Pavol Babincak pbabinca at redhat.com
Tue Dec 16 14:48:02 UTC 2014


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

it failed with error:

    xmlrpclib.Fault: <Fault 1: 'exceptions.TypeError: unsubscriptable
    object'>
---
 hub/kojihub.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hub/kojihub.py b/hub/kojihub.py
index f45bdf7..90c1263 100644
--- a/hub/kojihub.py
+++ b/hub/kojihub.py
@@ -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
 
-- 
1.9.3



More information about the buildsys mailing list