Skip to content

Commit

Permalink
fix(config): Raise proper error for missing config file
Browse files Browse the repository at this point in the history
When user supplies invalid config files setting it causes `anyconfig` to
raise problem with parsing `yaml` file - which is misleading.

Fix by verification of existence of config files before proceeding to
anyconfig.

fixes: #8844
  • Loading branch information
soyacz authored and fruch committed Sep 26, 2024
1 parent e53cfd6 commit 09ffaf8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions sdcm/sct_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1766,6 +1766,9 @@ def __init__(self): # noqa: PLR0912, PLR0914, PLR0915

# 2) load the config files
try:
for conf_file in list(config_files):
if not os.path.exists(conf_file):
raise FileNotFoundError(f"Couldn't find config file: {conf_file}")
files = anyconfig.load(list(config_files))
anyconfig.merge(self, files)
except ValueError:
Expand Down

0 comments on commit 09ffaf8

Please sign in to comment.