Fix a bug with setting project on topic

This commit fixes a small bug in pulling the project name from the
event. Previously it assumed 'project' was always a top level key,
but on some event types it's a subkey on the change field.
This commit is contained in:
Matthew Treinish 2016-05-26 12:10:53 -04:00
parent ca4033c595
commit 74a76a77f0
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 3 additions and 0 deletions

View File

@ -84,6 +84,9 @@ def get_options():
def get_topic(base_topic, event):
project = event.get('project', '')
event_type = event.get('type', '')
if not project:
if 'change' in event:
project = event['change'].get('project', '')
pieces = [base_topic, project, event_type]
topic = "/".join(pieces)
return topic