Revert "Fix blocking I/O while validating config schema" (#123377)

This commit is contained in:
Erik Montnemery 2024-08-08 17:30:39 +02:00 committed by GitHub
parent a406068f13
commit 60117ae150
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -817,9 +817,7 @@ async def async_process_ha_core_config(hass: HomeAssistant, config: dict) -> Non
This method is a coroutine.
"""
# CORE_CONFIG_SCHEMA is not async safe since it uses vol.IsDir
# so we need to run it in an executor job.
config = await hass.async_add_executor_job(CORE_CONFIG_SCHEMA, config)
config = CORE_CONFIG_SCHEMA(config)
# Only load auth during startup.
if not hasattr(hass, "auth"):
@ -1535,15 +1533,9 @@ async def async_process_component_config(
return IntegrationConfigInfo(None, config_exceptions)
# No custom config validator, proceed with schema validation
if config_schema := getattr(component, "CONFIG_SCHEMA", None):
if hasattr(component, "CONFIG_SCHEMA"):
try:
if domain in config:
# cv.isdir, cv.isfile, cv.isdevice are not async
# friendly so we need to run this in executor
schema = await hass.async_add_executor_job(config_schema, config)
else:
schema = config_schema(config)
return IntegrationConfigInfo(schema, [])
return IntegrationConfigInfo(component.CONFIG_SCHEMA(config), [])
except vol.Invalid as exc:
exc_info = ConfigExceptionInfo(
exc,