summaryrefslogtreecommitdiffstats
path: root/src/lib
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/Bcfg2/Server/Core.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py
index 782aafbf1..6f642e347 100644
--- a/src/lib/Bcfg2/Server/Core.py
+++ b/src/lib/Bcfg2/Server/Core.py
@@ -2,13 +2,14 @@
implementations inherit from. """
import os
-import atexit
-import logging
-import select
import sys
-import threading
import time
+import atexit
+import select
+import signal
+import logging
import inspect
+import threading
import lxml.etree
import Bcfg2.settings
import Bcfg2.Server
@@ -285,6 +286,14 @@ class BaseCore(object):
#: The CA that signed the server cert
self.ca = setup['ca']
+ def hdlr(sig, frame): # pylint: disable=W0613
+ """ Handle SIGINT/Ctrl-C by shutting down the core and exiting
+ properly. """
+ self.shutdown()
+ os._exit(1) # pylint: disable=W0212
+
+ signal.signal(signal.SIGINT, hdlr)
+
#: The FAM :class:`threading.Thread`,
#: :func:`_file_monitor_thread`
self.fam_thread = \