From e5f41843e5167678a458fd28d132304307e00b32 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Mon, 1 Dec 2014 07:42:24 -0800 Subject: Fix KeyError: 'sortKey' The data returned by the gerrit query are in the line format: ... 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 --- zuul/lib/gerrit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'zuul') 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" % -- cgit v1.2.1