gerrit: recognize project-created event

This change fix handling of project-created event type. In this event, the
project name is defined as 'projectName', and this needs to be added to the
event project_name to avoid exceptions being raised when trying to repr the
event.

Change-Id: I97a2f9ae7a2cef1727c63b25142f609dc76a212b
This commit is contained in:
Tristan Cacqueray
2018-04-11 06:11:30 +00:00
parent 38b26de3b3
commit 7ac55b6ff1
+3
View File
@@ -94,6 +94,8 @@ class GerritEventConnector(threading.Thread):
if event.project_name is None:
# ref-replica* events
event.project_name = data.get('project')
if event.type == 'project-created':
event.project_name = data.get('projectName')
# Map the event types to a field name holding a Gerrit
# account attribute. See Gerrit stream-event documentation
# in cmd-stream-events.html
@@ -111,6 +113,7 @@ class GerritEventConnector(threading.Thread):
'ref-replication-done': None,
'ref-replication-scheduled': None,
'topic-changed': 'changer',
'project-created': None, # Gerrit 2.14
}
event.account = None
if event.type in accountfield_from_type: