summaryrefslogtreecommitdiff
path: root/ick_controller.py
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2017-11-19 15:38:44 +0100
committerLars Wirzenius <liw@liw.fi>2017-11-19 15:38:44 +0100
commitd62d7c8622cc2d9d977f7d35741e8da1da381d5e (patch)
tree709c4a75c146b2628423b9a6292d9fe1c0c7ac86 /ick_controller.py
parent83aea836a74da1cd006e87c753900c49d54ee50a (diff)
downloadick2-d62d7c8622cc2d9d977f7d35741e8da1da381d5e.tar.gz
Add: check config (allows keys only, no None values)
Diffstat (limited to 'ick_controller.py')
-rw-r--r--ick_controller.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/ick_controller.py b/ick_controller.py
index 58b05e8..7c611a8 100644
--- a/ick_controller.py
+++ b/ick_controller.py
@@ -56,6 +56,15 @@ def load_config(filename, defconf):
return actual_config
+def check_config(config, musthave):
+ for key in config:
+ if key not in musthave:
+ raise Exception('Config %s is not known' % key)
+ for key in musthave:
+ if config.get(key) is None:
+ raise Exception('Config %s must not be None' % key)
+
+
def main():
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
@@ -76,6 +85,7 @@ def main():
logging.info('config is %r', config)
ick2.setup_logging(config)
+ check_config(config, default_config)
ick2.log.log('info', msg_text='Ick2 controller starts', config=config)
@@ -92,9 +102,12 @@ def main():
return application
except SystemExit:
- pass
+ raise
except BaseException as e:
logging.error(str(e))
+ ick2.log.log(
+ 'error', msg_text='Uncaught exception', exception=str(e),
+ exc_info=True)
sys.exit(1)