Skip to content
Snippets Groups Projects
Commit f735104d authored by Radoslav Bodó's avatar Radoslav Bodó
Browse files

rwm: more on config file error handling

parent 1ab0b17a
No related branches found
No related tags found
No related merge requests found
Pipeline #7714 passed
......@@ -709,7 +709,7 @@ def parse_arguments(argv):
return parser.parse_args(argv)
def load_config(path):
def load_config(path) -> dict:
"""load config dict from file"""
config = {}
......@@ -718,9 +718,10 @@ def load_config(path):
config_perms = config_path.stat().st_mode & 0o777
if config_perms != 0o600:
logger.warning(f"config file permissions ({config_perms:o}) are too-open")
config = yaml.safe_load(config_path.read_text(encoding='utf-8'))
except (OSError, ValueError) as exc:
config = dict(yaml.safe_load(config_path.read_text(encoding='utf-8')))
except (OSError, TypeError, ValueError) as exc:
logger.error(f"cannot load config file, {exc}")
logger.debug("config, %s", config)
return config
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment