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

Mike McLean mikem at redhat.com
Tue Dec 16 16:30:48 UTC 2014


On 12/16/2014 09:48 AM, Pavol Babincak wrote:
> 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
>  
> 

ack. will push this out soon


More information about the buildsys mailing list