Gerrit 2.5/2.6 stream-events has new event types
We run Gerrit 2.5 with most of 2.6 cherry picked in. At some point Gerrit has added some new events to the `stream-events` command: - draft-published - merge-failed - reviewer-added Each event comes with a field holding the account of the user performing the action. Since Gerrit uses different names for that field, we have to maintain a map to find out which key holds the account information. This patch update the map for the three new events. Also fixed a minor typo in an error message. Change-Id: I79032280884e50edf83a3ddf60af7a2f62bde971 Reviewed-on: https://review.openstack.org/22690 Reviewed-by: James E. Blair <corvus@inaugust.com> Reviewed-by: Clark Boylan <clark.boylan@gmail.com> Approved: James E. Blair <corvus@inaugust.com> Tested-by: Jenkins
This commit is contained in:
parent
feba967f30
commit
2dd66e733a
|
@ -64,16 +64,19 @@ class GerritEventConnector(threading.Thread):
|
|||
# in cmd-stream-events.html
|
||||
accountfield_from_type = {
|
||||
'patchset-created': 'uploader',
|
||||
'draft-published': 'uploader', # Gerrit 2.5/2.6
|
||||
'change-abandoned': 'abandoner',
|
||||
'change-restored': 'restorer',
|
||||
'change-merged': 'submitter',
|
||||
'merge-failed': 'submitter', # Gerrit 2.5/2.6
|
||||
'comment-added': 'author',
|
||||
'ref-updated': 'submitter',
|
||||
'reviewer-added': 'reviewer', # Gerrit 2.5/2.6
|
||||
}
|
||||
try:
|
||||
event.account = data.get(accountfield_from_type[event.type])
|
||||
except KeyError:
|
||||
self.log.error("Received unrecongized event type '%s' from Gerrit.\
|
||||
self.log.error("Received unrecognized event type '%s' from Gerrit.\
|
||||
Can not get account information." % event.type)
|
||||
event.account = None
|
||||
|
||||
|
|
Loading…
Reference in New Issue