From d8063ad5f5d15b179b4e47a645e928f690fe9809 Mon Sep 17 00:00:00 2001 From: Matthew Treinish Date: Mon, 29 Feb 2016 17:22:01 -0500 Subject: [PATCH] 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 --- files/subunit-gearman-worker.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/files/subunit-gearman-worker.py b/files/subunit-gearman-worker.py index bcaab0f..11b447d 100644 --- a/files/subunit-gearman-worker.py +++ b/files/subunit-gearman-worker.py @@ -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'))