[PATCH] Check that opts is not None before accessing.

Ralph Bean rbean at redhat.com
Sat May 9 12:25:41 UTC 2015


On Fri, May 08, 2015 at 11:56:40AM -0400, Ralph Bean wrote:
> This should fix the periodic 500 error we get from koji-web in Fedora
> Infra's staging environment.
> 
> Signed-off-by: Ralph Bean <rbean at redhat.com>
> ---
>  www/lib/kojiweb/util.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/www/lib/kojiweb/util.py b/www/lib/kojiweb/util.py
> index 89a5ddb..6610beb 100644
> --- a/www/lib/kojiweb/util.py
> +++ b/www/lib/kojiweb/util.py
> @@ -466,7 +466,7 @@ def taskScratchClass(task_object):
>      request = task_object['request']
>      if len(request) >= 3:
>          opts = request[2]
> -        if opts.get('scratch'):
> +        if opts and opts.get('scratch'):
>              return "scratch"
>      return ""
>  
> -- 
> 2.1.0
> 

FYI, we miscommunicated about this in #fedora-releng yesterday and the
unpatched version got pushed out to prod.  This means that every now
and then, the koji frontpage fails with 500 (until the task with
`opts == None` scrolls off the "Recent Tasks" pane).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://lists.fedoraproject.org/pipermail/buildsys/attachments/20150509/bc0b3128/attachment.sig>


More information about the buildsys mailing list