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. Change-Id: I495c225022250f9fa055c12c422071b1f42ff753
This commit is contained in:
parent
e17d562000
commit
b2ad9ad0e5
@ -85,15 +85,22 @@ class GerritChange(object):
|
||||
|
||||
# Instantiate object with retrieved data
|
||||
self.raw_data = decoded
|
||||
self.approvers = [i['email']
|
||||
for i in decoded['labels']['Code-Review']['all']
|
||||
if i['value'] > 0]
|
||||
self.approvers.append(decoded['owner']['email'])
|
||||
currev = decoded['current_revision']
|
||||
self.deliv_files = [
|
||||
x for x in decoded['revisions'][currev]['files'].keys()
|
||||
if x.startswith('deliverables/')
|
||||
]
|
||||
try:
|
||||
self.approvers = [i['email']
|
||||
for i in decoded['labels']['Code-Review']['all']
|
||||
if i['value'] > 0]
|
||||
self.approvers.append(decoded['owner']['email'])
|
||||
currev = decoded['current_revision']
|
||||
self.deliv_files = [
|
||||
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):
|
||||
|
Loading…
x
Reference in New Issue
Block a user