Add source_url to mqtt payload

This commit adds the source_url to the mqtt payload for events emitted
by the subunit worker. Just the build_uuid isn't enough to figure out
what's going on because we typically do 2 events for each uuid, one with
a .gz extension and the other not. We need to distinguish between the 2
to figure out what's actually going on.

Change-Id: I56f0b9fb1128b412cd88e49164eb91c3e9e3e4cb
This commit is contained in:
Matthew Treinish 2017-04-26 17:01:25 -04:00
parent 4037e7b1ba
commit c8b965bde6
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 3 additions and 0 deletions

View File

@ -111,6 +111,7 @@ class SubunitRetriever(object):
def _handle_event(self):
fields = {}
source_url = ''
job = self.gearman_worker.getJob()
try:
arguments = json.loads(job.arguments.decode('utf-8'))
@ -138,6 +139,7 @@ class SubunitRetriever(object):
if self.mqtt:
msg = json.dumps({
'build_uuid': out_event.get('build_uuid'),
'source_url': source_url,
'status': 'success',
})
self.mqtt.publish_single(msg, out_event.get('project'),
@ -148,6 +150,7 @@ class SubunitRetriever(object):
if self.mqtt:
msg = json.dumps({
'build_uuid': fields.get('build_uuid'),
'source_url': source_url,
'status': 'failed',
})
self.mqtt.publish_single(msg, fields.get('project'),