Fix bug on missing subunit2sql data

This commit fixes an issue when handling a nonexistent subunit stream.
The script was returning on gearman an error but then continued to
use the internally queue up the subunit event to process, even though
there wasn't a stream. This would cause a stacktrace later when the
actual processing was done on the internal queue. This commit adds
the queueing inside an else block to prevent it from running when
we don't have a subunit stream.

Change-Id: I66fdc5d7ae3702411a0b42757087cf61a4c69e35
This commit is contained in:
Matthew Treinish 2016-02-29 17:22:01 -05:00
parent a8e4c8322d
commit d8063ad5f5
No known key found for this signature in database
GPG Key ID: FD12A0F214C9E177
1 changed files with 6 additions and 5 deletions

View File

@ -85,11 +85,12 @@ class SubunitRetriever(threading.Thread):
if not subunit_io:
job.sendWorkException(
'Unable to retrieve subunit stream'.encode('utf8'))
logging.debug("Pushing subunit files.")
out_event = fields.copy()
out_event["subunit"] = subunit_io
self.subunitq.put(out_event)
job.sendWorkComplete()
else:
logging.debug("Pushing subunit files.")
out_event = fields.copy()
out_event["subunit"] = subunit_io
self.subunitq.put(out_event)
job.sendWorkComplete()
except Exception as e:
logging.exception("Exception handling log event.")
job.sendWorkException(str(e).encode('utf-8'))