From b3c24afb0c8b21ca1b8cf838ed06de5c35f04677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu> Date: Wed, 26 Oct 2016 09:45:57 +0200 Subject: [PATCH] Changed config loading error management. --- envsetup.py | 5 ++++- utils.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/envsetup.py b/envsetup.py index 539a8bae..e52df8ae 100755 --- a/envsetup.py +++ b/envsetup.py @@ -61,7 +61,10 @@ class EnvSetup(): log('This script should be run as root user.') sys.exit(1) # Load conf - utils.load_conf() + conf = utils.load_conf() + if not conf: + log('No configuration loaded.') + sys.exit(1) if args: # Run command for arg in args: diff --git a/utils.py b/utils.py index 547bf739..c6badef4 100644 --- a/utils.py +++ b/utils.py @@ -52,7 +52,7 @@ def load_conf(): if not os.path.exists(path): log('The configuration file for EnvSetup script does not exist.\nPath of configuration file: %s' % path, error=True) if is_default: - sys.exit(1) + return dict() # Load conf with open(path, 'r') as fo: content = fo.read() -- GitLab