check-release-approval: log Gerrit data on error
We've had hard-to-track exceptions with missing keys in Gerrit
query answers. Let's log the JSON in case of KeyError parsing
Gerrit response.
@@ -85,6 +85,7 @@ class GerritChange(object):
# Instantiate object with retrieved data
self.raw_data = decoded
+ try:
self.approvers = [i['email']
for i in decoded['labels']['Code-Review']['all']
if i['value'] > 0]
@@ -94,6 +95,12 @@ class GerritChange(object):
x for x in decoded['revisions'][currev]['files'].keys()
if x.startswith('deliverables/')
]
+ except KeyError:
+ LOG.error(
+ '\ndata from gerrit is missing required keys:\n\n%s\n',
+ json.dumps(decoded, indent=2))
+ raise
+
self.workspace = args.releases
def is_approved(self):
