From 40c4ff7fb1ca2c6ea30a024026540af14af83622 Mon Sep 17 00:00:00 2001 From: Serge Rehbinder Date: Tue, 17 Jan 2017 10:18:01 +0100 Subject: [PATCH] Print a warning instead of raising an error when a product pyconf file cannot be read. --- commands/config.py | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/commands/config.py b/commands/config.py index cb5863f..e3d0f97 100644 --- a/commands/config.py +++ b/commands/config.py @@ -294,9 +294,11 @@ class ConfigManager: project_cfg = src.pyconf.Config(open(project_pyconf_path), PWD=("", project_pyconf_dir)) except Exception as e: - raise src.SatException(_("Error in configuration file: " - "%(file_path)s\n %(error)s") % \ - {'file_path' : project_pyconf_path, 'error': str(e) }) + msg = _("WARNING: Error in configuration file: " + "%(file_path)s\n %(error)s\n") % \ + {'file_path' : project_pyconf_path, 'error': str(e) } + sys.stdout.write(msg) + continue projects_cfg.PROJECTS.projects.addMapping(project_name, src.pyconf.Mapping(projects_cfg.PROJECTS.projects), "The %s project\n" % project_name) @@ -361,17 +363,13 @@ class ConfigManager: os.path.join(products_dir, fName)), PWD=("", products_dir)) - except src.pyconf.ConfigError as e: - raise src.SatException(_( - "Error in configuration file: %(prod)s\n %(error)s") % \ - {'prod' : fName, 'error': str(e) }) - except IOError as error: - e = str(error) - raise src.SatException( e ); except Exception as e: - raise src.SatException(_( - "Error in configuration file: %(prod)s\n %(error)s") % \ + msg = _( + "WARNING: Error in configuration file" + ": %(prod)s\n %(error)s" % \ {'prod' : fName, 'error': str(e) }) + sys.stdout.write(msg) + continue products_cfg.PRODUCTS[pName] = prod_cfg -- 2.39.2