Make config parsing more robust against errors
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 19 Jun 2018 08:30:46 +0000 (10:30 +0200)
committerJonatan Schlag <jonatan.schlag@ipfire.org>
Tue, 19 Jun 2018 08:30:46 +0000 (10:30 +0200)
This just catches any errors when we parse our config

Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
src/nitsi/test.py

index 97330c2..8d29e30 100755 (executable)
@@ -40,8 +40,13 @@ class Test():
             raise TestException("No recipe file found")
 
     def read_settings(self):
-        self.config = configparser.ConfigParser()
-        self.config.read(self.settings_file)
+        try:
+            self.config = configparser.ConfigParser()
+            self.config.read(self.settings_file)
+        except BaseException as e:
+            self.log.error("Failed to parse the config")
+            raise e
+
         self.name = self.config["DEFAULT"]["name"]
         self.description = self.config["DEFAULT"]["description"]
         self.copy_to = self.config["DEFAULT"]["copy_to"]