Better errors for unknown secrets (#13072)
This commit is contained in:
parent
d74a2b68c1
commit
f164a5a65f
2 changed files with 6 additions and 3 deletions
|
@ -140,6 +140,9 @@ def run(script_args: List) -> int:
|
|||
|
||||
print(color(C_HEAD, 'Used Secrets:'))
|
||||
for skey, sval in res['secrets'].items():
|
||||
if sval is None:
|
||||
print(' -', skey + ':', color('red', "not found"))
|
||||
continue
|
||||
print(' -', skey + ':', sval, color('cyan', '[from:', flatsecret
|
||||
.get(skey, 'keyring') + ']'))
|
||||
|
||||
|
@ -308,7 +311,8 @@ def check_ha_config_file(config_dir):
|
|||
return result.add_error("File configuration.yaml not found.")
|
||||
config = load_yaml_config_file(config_path)
|
||||
except HomeAssistantError as err:
|
||||
return result.add_error(err)
|
||||
return result.add_error(
|
||||
"Error loading {}: {}".format(config_path, err))
|
||||
finally:
|
||||
yaml.clear_secret_cache()
|
||||
|
||||
|
|
|
@ -288,8 +288,7 @@ def _secret_yaml(loader: SafeLineLoader,
|
|||
# Catch if package installed and no config
|
||||
credstash = None
|
||||
|
||||
_LOGGER.error("Secret %s not defined", node.value)
|
||||
raise HomeAssistantError(node.value)
|
||||
raise HomeAssistantError("Secret {} not defined".format(node.value))
|
||||
|
||||
|
||||
yaml.SafeLoader.add_constructor('!include', _include_yaml)
|
||||
|
|
Loading…
Add table
Reference in a new issue