From f948b4f293ee3c708522f18934432273d51fe882 Mon Sep 17 00:00:00 2001 From: Dionysis Grigoropoulos Date: Fri, 29 Aug 2014 17:43:30 +0300 Subject: [PATCH] Handle exceptions during config file parsing Handle uncaught exceptions during config file parsing --- lib/ansible/constants.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ansible/constants.py b/lib/ansible/constants.py index 8025706dad1..117f688853d 100644 --- a/lib/ansible/constants.py +++ b/lib/ansible/constants.py @@ -71,7 +71,11 @@ def load_config_file(): for path in [path0, path1, path2, path3]: if path is not None and os.path.exists(path): - p.read(path) + try: + p.read(path) + except ConfigParser.Error as e: + print "Error reading config file: \n%s" % e + sys.exit(1) return p return None