mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 21:27:38 +00:00
Quote domain name in setup logs (#104239)
* Quote domain name in setup logs * Update tests
This commit is contained in:
parent
d90605f9bc
commit
67e25dc0bf
@ -157,7 +157,7 @@ async def _async_process_dependencies(
|
|||||||
|
|
||||||
if failed:
|
if failed:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Unable to set up dependencies of %s. Setup failed for dependencies: %s",
|
"Unable to set up dependencies of '%s'. Setup failed for dependencies: %s",
|
||||||
integration.domain,
|
integration.domain,
|
||||||
", ".join(failed),
|
", ".join(failed),
|
||||||
)
|
)
|
||||||
@ -183,7 +183,7 @@ async def _async_setup_component(
|
|||||||
custom = "" if integration.is_built_in else "custom integration "
|
custom = "" if integration.is_built_in else "custom integration "
|
||||||
link = integration.documentation
|
link = integration.documentation
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
"Setup failed for %s%s: %s", custom, domain, msg, exc_info=exc_info
|
"Setup failed for %s'%s': %s", custom, domain, msg, exc_info=exc_info
|
||||||
)
|
)
|
||||||
async_notify_setup_error(hass, domain, link)
|
async_notify_setup_error(hass, domain, link)
|
||||||
|
|
||||||
@ -234,8 +234,8 @@ async def _async_setup_component(
|
|||||||
):
|
):
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
(
|
(
|
||||||
"The %s integration does not support YAML setup, please remove it from "
|
"The '%s' integration does not support YAML setup, please remove it "
|
||||||
"your configuration"
|
"from your configuration"
|
||||||
),
|
),
|
||||||
domain,
|
domain,
|
||||||
)
|
)
|
||||||
@ -289,7 +289,7 @@ async def _async_setup_component(
|
|||||||
except asyncio.TimeoutError:
|
except asyncio.TimeoutError:
|
||||||
_LOGGER.error(
|
_LOGGER.error(
|
||||||
(
|
(
|
||||||
"Setup of %s is taking longer than %s seconds."
|
"Setup of '%s' is taking longer than %s seconds."
|
||||||
" Startup will proceed without waiting any longer"
|
" Startup will proceed without waiting any longer"
|
||||||
),
|
),
|
||||||
domain,
|
domain,
|
||||||
@ -356,7 +356,9 @@ async def async_prepare_setup_platform(
|
|||||||
def log_error(msg: str) -> None:
|
def log_error(msg: str) -> None:
|
||||||
"""Log helper."""
|
"""Log helper."""
|
||||||
|
|
||||||
_LOGGER.error("Unable to prepare setup for platform %s: %s", platform_path, msg)
|
_LOGGER.error(
|
||||||
|
"Unable to prepare setup for platform '%s': %s", platform_path, msg
|
||||||
|
)
|
||||||
async_notify_setup_error(hass, platform_path)
|
async_notify_setup_error(hass, platform_path)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -133,6 +133,6 @@ async def test_button_invalid(
|
|||||||
assert f"Invalid config for 'knx': {error_msg}" in record.message
|
assert f"Invalid config for 'knx': {error_msg}" in record.message
|
||||||
record = caplog.records[1]
|
record = caplog.records[1]
|
||||||
assert record.levelname == "ERROR"
|
assert record.levelname == "ERROR"
|
||||||
assert "Setup failed for knx: Invalid config." in record.message
|
assert "Setup failed for 'knx': Invalid config." in record.message
|
||||||
assert hass.states.get("button.test") is None
|
assert hass.states.get("button.test") is None
|
||||||
assert hass.data.get(DOMAIN) is None
|
assert hass.data.get(DOMAIN) is None
|
||||||
|
@ -523,7 +523,7 @@ async def test_platform_error_slow_setup(
|
|||||||
result = await setup.async_setup_component(hass, "test_component1", {})
|
result = await setup.async_setup_component(hass, "test_component1", {})
|
||||||
assert len(called) == 1
|
assert len(called) == 1
|
||||||
assert not result
|
assert not result
|
||||||
assert "test_component1 is taking longer than 0.1 seconds" in caplog.text
|
assert "'test_component1' is taking longer than 0.1 seconds" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_when_setup_already_loaded(hass: HomeAssistant) -> None:
|
async def test_when_setup_already_loaded(hass: HomeAssistant) -> None:
|
||||||
@ -653,7 +653,7 @@ async def test_integration_logs_is_custom(
|
|||||||
):
|
):
|
||||||
result = await setup.async_setup_component(hass, "test_component1", {})
|
result = await setup.async_setup_component(hass, "test_component1", {})
|
||||||
assert not result
|
assert not result
|
||||||
assert "Setup failed for custom integration test_component1: Boom" in caplog.text
|
assert "Setup failed for custom integration 'test_component1': Boom" in caplog.text
|
||||||
|
|
||||||
|
|
||||||
async def test_async_get_loaded_integrations(hass: HomeAssistant) -> None:
|
async def test_async_get_loaded_integrations(hass: HomeAssistant) -> None:
|
||||||
@ -735,7 +735,7 @@ async def test_setup_config_entry_from_yaml(
|
|||||||
) -> None:
|
) -> None:
|
||||||
"""Test attempting to setup an integration which only supports config_entries."""
|
"""Test attempting to setup an integration which only supports config_entries."""
|
||||||
expected_warning = (
|
expected_warning = (
|
||||||
"The test_integration_only_entry integration does not support YAML setup, "
|
"The 'test_integration_only_entry' integration does not support YAML setup, "
|
||||||
"please remove it from your configuration"
|
"please remove it from your configuration"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user