summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Treinish <mtreinish@kortar.org>2016-02-29 17:22:01 -0500
committerMatthew Treinish <mtreinish@kortar.org>2016-02-29 17:25:55 -0500
commitd8063ad5f5d15b179b4e47a645e928f690fe9809 (patch)
tree53d18e7e5d0dd742210053d5b1a185de34646f0c
parenta8e4c8322d89fae7edf25fc502ed833f8ea682de (diff)
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
Notes
Notes (review): Code-Review+1: Anita Kuno <anteaya@anteaya.info> Code-Review+2: Jeremy Stanley <fungi@yuggoth.org> Code-Review+2: Spencer Krum <nibz@spencerkrum.com> Workflow+1: Spencer Krum <nibz@spencerkrum.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 01 Mar 2016 00:46:57 +0000 Reviewed-on: https://review.openstack.org/286304 Project: openstack-infra/puppet-subunit2sql Branch: refs/heads/master
-rw-r--r--files/subunit-gearman-worker.py11
1 files 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):
85 if not subunit_io: 85 if not subunit_io:
86 job.sendWorkException( 86 job.sendWorkException(
87 'Unable to retrieve subunit stream'.encode('utf8')) 87 'Unable to retrieve subunit stream'.encode('utf8'))
88 logging.debug("Pushing subunit files.") 88 else:
89 out_event = fields.copy() 89 logging.debug("Pushing subunit files.")
90 out_event["subunit"] = subunit_io 90 out_event = fields.copy()
91 self.subunitq.put(out_event) 91 out_event["subunit"] = subunit_io
92 job.sendWorkComplete() 92 self.subunitq.put(out_event)
93 job.sendWorkComplete()
93 except Exception as e: 94 except Exception as e:
94 logging.exception("Exception handling log event.") 95 logging.exception("Exception handling log event.")
95 job.sendWorkException(str(e).encode('utf-8')) 96 job.sendWorkException(str(e).encode('utf-8'))