summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJenkins <jenkins@review.openstack.org>2016-05-26 06:38:14 +0000
committerGerrit Code Review <review@openstack.org>2016-05-26 06:38:14 +0000
commit857d8db60c732e4d38eda3bbbb871077fe1a36bb (patch)
tree403ac1e988461a6c021b4acfb4c2ced6fc7cbb3c
parentef045797a97b257424fd4e45f7ee6ad6cce31212 (diff)
parent75492cf82b4692eca5939f22c8db1fb89d278df7 (diff)
downloadkolla-857d8db60c732e4d38eda3bbbb871077fe1a36bb.tar.gz
kolla-857d8db60c732e4d38eda3bbbb871077fe1a36bb.zip
Merge "Implement non-default signal handler for SIGINT"
-rwxr-xr-xkolla/cmd/build.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/kolla/cmd/build.py b/kolla/cmd/build.py
index b1cc5bb9d..bbd9788ad 100755
--- a/kolla/cmd/build.py
+++ b/kolla/cmd/build.py
@@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-# TODO(jpeeler): Add clean up handler for SIGINT
from __future__ import print_function
import datetime
@@ -55,7 +54,13 @@ logging.basicConfig()
LOG = logging.getLogger(__name__)
LOG.setLevel(logging.INFO)
-signal.signal(signal.SIGINT, signal.SIG_DFL)
+
+def handle_ctrlc(single, frame):
+ kollaobj = frame.f_locals['kolla']
+ kollaobj.cleanup()
+ sys.exit(1)
+
+signal.signal(signal.SIGINT, handle_ctrlc)
class KollaDirNotFoundException(Exception):
@@ -776,9 +781,9 @@ def main():
push_thread = PushThread(conf, push_queue)
push_thread.start()
- # block until queue is empty
- queue.join()
- push_queue.join()
+ # sleep until queue is empty
+ while queue.unfinished_tasks or push_queue.unfinished_tasks:
+ time.sleep(3)
kolla.summary()
kolla.cleanup()