Log errors when loading yaml (#6257)

This commit is contained in:
Johann Kellerman 2017-03-01 06:56:23 +02:00 committed by GitHub
parent a0256e1947
commit ac49298c8d
4 changed files with 25 additions and 9 deletions

View file

@ -30,6 +30,8 @@ MOCKS = {
config_util.async_log_exception),
'package_error': ("homeassistant.config._log_pkg_error",
config_util._log_pkg_error),
'logger_exception': ("homeassistant.bootstrap._LOGGER.error",
bootstrap._LOGGER.error),
}
SILENCE = (
'homeassistant.bootstrap.clear_secret_cache',
@ -180,9 +182,9 @@ def check(config_path):
if module is None:
# Ensure list
res['except'][ERROR_STR] = res['except'].get(ERROR_STR, [])
res['except'][ERROR_STR].append('{} not found: {}'.format(
'Platform' if '.' in comp_name else 'Component', comp_name))
msg = '{} not found: {}'.format(
'Platform' if '.' in comp_name else 'Component', comp_name)
res['except'].setdefault(ERROR_STR, []).append(msg)
return None
# Test if platform/component and overwrite setup
@ -224,6 +226,11 @@ def check(config_path):
res['except'][pkg_key] = config.get('homeassistant', {}) \
.get('packages', {}).get(package)
def mock_logger_exception(msg, *params):
"""Log logger.exceptions."""
res['except'].setdefault(ERROR_STR, []).append(msg % params)
MOCKS['logger_exception'][1](msg, *params)
# Patches to skip functions
for sil in SILENCE:
PATCHES[sil] = patch(sil)