Extract ruamel.yaml to util with secrets, lovelace ws decorators (#17958)
* Extract ruamel.yaml to util, ws decorators, secrets * lint * Extend SafeConstructor Somehow my last commit is gone after rebase... * lint * Woof... * Woof woof... * Cleanup type hints * Update homeassistant/scripts/check_config.py * lint * typing
This commit is contained in:
1 parent
1578187376
commit
b763c0f902
10 files changed
+452
-385
No files matched your search
@@ -30,7 +30,7 @@ _LOGGER = logging.getLogger(__name__)
|
||||
MOCKS = {
|
||||
'load': ("homeassistant.util.yaml.load_yaml", yaml.load_yaml),
|
||||
'load*': ("homeassistant.config.load_yaml", yaml.load_yaml),
|
||||
'secrets': ("homeassistant.util.yaml._secret_yaml", yaml._secret_yaml),
|
||||
'secrets': ("homeassistant.util.yaml.secret_yaml", yaml.secret_yaml),
|
||||
}
|
||||
SILENCE = (
|
||||
'homeassistant.scripts.check_config.yaml.clear_secret_cache',
|
||||
@@ -198,7 +198,7 @@ def check(config_dir, secrets=False):
|
||||
|
||||
if secrets:
|
||||
# Ensure !secrets point to the patched function
|
||||
yaml.yaml.SafeLoader.add_constructor('!secret', yaml._secret_yaml)
|
||||
yaml.yaml.SafeLoader.add_constructor('!secret', yaml.secret_yaml)
|
||||
|
||||
try:
|
||||
hass = core.HomeAssistant()
|
||||
@@ -223,7 +223,7 @@ def check(config_dir, secrets=False):
|
||||
pat.stop()
|
||||
if secrets:
|
||||
# Ensure !secrets point to the original function
|
||||
yaml.yaml.SafeLoader.add_constructor('!secret', yaml._secret_yaml)
|
||||
yaml.yaml.SafeLoader.add_constructor('!secret', yaml.secret_yaml)
|
||||
bootstrap.clear_secret_cache()
|
||||
|
||||
return res
|
||||
|
||||
Reference in new issue
Block a user