summaryrefslogtreecommitdiff
path: root/zuul
diff options
context:
space:
mode:
authorJames E. Blair <jeblair@hp.com>2014-12-01 07:42:24 -0800
committerSean Dague <sean@dague.net>2014-12-01 10:56:35 -0500
commite5f41843e5167678a458fd28d132304307e00b32 (patch)
tree4483ad6da3b6f4574ab0a33ba5beb4cf15150b13 /zuul
parent186a1d5261a61d16df2210bbfb29a999f3369cf8 (diff)
downloadzuul-e5f41843e5167678a458fd28d132304307e00b32.tar.gz
Fix KeyError: 'sortKey'
The data returned by the gerrit query are in the line format: <json for change 1> <json for change 2> ... <json for change N> <json of query stats> <blank line> The current [:-1] dropped the blank line, and previously the Gerrit trigger would then drop the query stats with a [:-1]. That has since been removed. However, it needs to be dropped before the simpleQuery processor performs the sortKey lookup. Instead, drop any lines which don't include 'sortKey', which means they aren't valid data lines (they are either stats lines, the blank, or some other cruft). Change-Id: I2b8ffdc70af436b34e7cee431ec4820c6e2d91c3
Diffstat (limited to 'zuul')
-rw-r--r--zuul/lib/gerrit.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/zuul/lib/gerrit.py b/zuul/lib/gerrit.py
index 799459d47..5aad953f3 100644
--- a/zuul/lib/gerrit.py
+++ b/zuul/lib/gerrit.py
@@ -156,7 +156,8 @@ class Gerrit(object):
lines = out.split('\n')
if not lines:
return False
- data = [json.loads(line) for line in lines[:-1]]
+ data = [json.loads(line) for line in lines
+ if "sortKey" in line]
if not data:
return False
self.log.debug("Received data from Gerrit query: \n%s" %