Fix silent config errors (#3380)

This commit is contained in:
Jesse Hills 2022-04-13 12:26:25 +12:00 committed by GitHub
parent d620b6dd5e
commit a519e5c475
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,6 +161,7 @@ class Config(OrderedDict, fv.FinalValidateConfig):
# type: (ConfigPath) -> Optional[vol.Invalid]
for err in self.errors:
if self.get_deepest_path(err.path) == path:
self.errors.remove(err)
return err
return None
@ -647,7 +648,7 @@ class FinalValidateValidationStep(ConfigValidationStep):
fv.full_config.reset(token)
def validate_config(config, command_line_substitutions):
def validate_config(config, command_line_substitutions) -> Config:
result = Config()
loader.clear_component_meta_finders()
@ -734,9 +735,6 @@ def validate_config(config, command_line_substitutions):
result.add_validation_step(LoadValidationStep(key, config[key]))
result.run_validation_steps()
if result.errors:
return result
for domain, conf in config.items():
result.add_validation_step(LoadValidationStep(domain, conf))
result.add_validation_step(IDPassValidationStep())
@ -991,5 +989,10 @@ def read_config(command_line_substitutions):
errstr += f" {errline}"
safe_print(errstr)
safe_print(indent(dump_dict(res, path)[0]))
for err in res.errors:
safe_print(color(Fore.BOLD_RED, err.msg))
safe_print("")
return None
return OrderedDict(res)