mirror of
https://github.com/esphome/esphome.git
synced 2024-12-22 13:34:54 +01:00
Fix silent config errors (#3380)
This commit is contained in:
parent
d620b6dd5e
commit
a519e5c475
1 changed files with 7 additions and 4 deletions
|
@ -161,6 +161,7 @@ class Config(OrderedDict, fv.FinalValidateConfig):
|
||||||
# type: (ConfigPath) -> Optional[vol.Invalid]
|
# type: (ConfigPath) -> Optional[vol.Invalid]
|
||||||
for err in self.errors:
|
for err in self.errors:
|
||||||
if self.get_deepest_path(err.path) == path:
|
if self.get_deepest_path(err.path) == path:
|
||||||
|
self.errors.remove(err)
|
||||||
return err
|
return err
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -647,7 +648,7 @@ class FinalValidateValidationStep(ConfigValidationStep):
|
||||||
fv.full_config.reset(token)
|
fv.full_config.reset(token)
|
||||||
|
|
||||||
|
|
||||||
def validate_config(config, command_line_substitutions):
|
def validate_config(config, command_line_substitutions) -> Config:
|
||||||
result = Config()
|
result = Config()
|
||||||
|
|
||||||
loader.clear_component_meta_finders()
|
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.add_validation_step(LoadValidationStep(key, config[key]))
|
||||||
result.run_validation_steps()
|
result.run_validation_steps()
|
||||||
|
|
||||||
if result.errors:
|
|
||||||
return result
|
|
||||||
|
|
||||||
for domain, conf in config.items():
|
for domain, conf in config.items():
|
||||||
result.add_validation_step(LoadValidationStep(domain, conf))
|
result.add_validation_step(LoadValidationStep(domain, conf))
|
||||||
result.add_validation_step(IDPassValidationStep())
|
result.add_validation_step(IDPassValidationStep())
|
||||||
|
@ -991,5 +989,10 @@ def read_config(command_line_substitutions):
|
||||||
errstr += f" {errline}"
|
errstr += f" {errline}"
|
||||||
safe_print(errstr)
|
safe_print(errstr)
|
||||||
safe_print(indent(dump_dict(res, path)[0]))
|
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 None
|
||||||
return OrderedDict(res)
|
return OrderedDict(res)
|
||||||
|
|
Loading…
Reference in a new issue