Don't die on unrecognized gerrit review labels.
The chromite code on old branches doesn't recognize the recently-
added 'Trybot-Verified' label. With this change, unrecognized label
are quietly ignored.
BUG=326381
TEST=None
Change-Id: I64935e1af71e411fa09019583ef10a8eba11e717
Reviewed-on: https://chromium-review.googlesource.com/179163
Reviewed-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Commit-Queue: Stefan Zager <szager@chromium.org>
Tested-by: Stefan Zager <szager@chromium.org>
diff --git a/lib/patch.py b/lib/patch.py
index e977026..c0ce8d7 100644
--- a/lib/patch.py
+++ b/lib/patch.py
@@ -1100,9 +1100,12 @@
approvals = []
for label, label_data in change['labels'].iteritems():
for review_data in label_data.get('all', []):
+ label_type = constants.GERRIT_ON_BORG_LABELS.get(label)
+ if not label_type:
+ continue
granted_on = review_data.get('date', change['created'])
approvals.append({
- 'type': constants.GERRIT_ON_BORG_LABELS[label],
+ 'type': label_type,
'description': label,
'value': str(review_data.get('value', '0')),
'grantedOn': _convert_tm(granted_on),