mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 03:37:07 +00:00
Minor improvements of service helper (#147079)
This commit is contained in:
parent
6befd065a1
commit
8d8ff011fc
@ -718,7 +718,6 @@ async def async_get_all_descriptions(
|
||||
for service_name in services_by_domain
|
||||
}
|
||||
# If we have a complete cache, check if it is still valid
|
||||
all_cache: tuple[set[tuple[str, str]], dict[str, dict[str, Any]]] | None
|
||||
if all_cache := hass.data.get(ALL_SERVICE_DESCRIPTIONS_CACHE):
|
||||
previous_all_services, previous_descriptions_cache = all_cache
|
||||
# If the services are the same, we can return the cache
|
||||
@ -744,7 +743,11 @@ async def async_get_all_descriptions(
|
||||
continue
|
||||
if TYPE_CHECKING:
|
||||
assert isinstance(int_or_exc, Exception)
|
||||
_LOGGER.error("Failed to load integration: %s", domain, exc_info=int_or_exc)
|
||||
_LOGGER.error(
|
||||
"Failed to load services.yaml for integration: %s",
|
||||
domain,
|
||||
exc_info=int_or_exc,
|
||||
)
|
||||
|
||||
if integrations:
|
||||
loaded = await hass.async_add_executor_job(
|
||||
@ -772,7 +775,7 @@ async def async_get_all_descriptions(
|
||||
# Cache missing descriptions
|
||||
domain_yaml = loaded.get(domain) or {}
|
||||
# The YAML may be empty for dynamically defined
|
||||
# services (ie shell_command) that never call
|
||||
# services (e.g. shell_command) that never call
|
||||
# service.async_set_service_schema for the dynamic
|
||||
# service
|
||||
|
||||
|
@ -1141,7 +1141,7 @@ async def test_async_get_all_descriptions_failing_integration(
|
||||
descriptions = await service.async_get_all_descriptions(hass)
|
||||
|
||||
assert len(descriptions) == 3
|
||||
assert "Failed to load integration: logger" in caplog.text
|
||||
assert "Failed to load services.yaml for integration: logger" in caplog.text
|
||||
|
||||
# Services are empty defaults if the load fails but should
|
||||
# not raise
|
||||
|
Loading…
x
Reference in New Issue
Block a user