mirror of
https://github.com/home-assistant/core.git
synced 2025-12-24 12:59:34 +00:00
Revert "Avoid pre-importing config_flows if the integration does not … (#113553)
Revert "Avoid pre-importing config_flows if the integration does not support …"
This reverts commit 9940f51b95.
This commit is contained in:
@@ -349,9 +349,6 @@ class ConfigEntry:
|
||||
# Supports remove device
|
||||
self.supports_remove_device: bool | None = None
|
||||
|
||||
# Supports migrate
|
||||
self.supports_migrate: bool | None = None
|
||||
|
||||
# Supports options
|
||||
self._supports_options: bool | None = None
|
||||
|
||||
@@ -494,7 +491,6 @@ class ConfigEntry:
|
||||
self.supports_remove_device = await support_remove_from_device(
|
||||
hass, self.domain
|
||||
)
|
||||
|
||||
try:
|
||||
component = await integration.async_get_component()
|
||||
except ImportError as err:
|
||||
@@ -510,12 +506,7 @@ class ConfigEntry:
|
||||
)
|
||||
return
|
||||
|
||||
if self.supports_migrate is None:
|
||||
self.supports_migrate = hasattr(component, "async_migrate_entry")
|
||||
|
||||
if domain_is_integration and self.supports_migrate:
|
||||
# Avoid loading the config_flow module unless we need to check
|
||||
# the version to see if we need to migrate
|
||||
if domain_is_integration:
|
||||
try:
|
||||
await integration.async_get_platforms(("config_flow",))
|
||||
except ImportError as err:
|
||||
@@ -796,7 +787,11 @@ class ConfigEntry:
|
||||
if same_major_version and self.minor_version == handler.MINOR_VERSION:
|
||||
return True
|
||||
|
||||
if not self.supports_migrate:
|
||||
if not (integration := self._integration_for_domain):
|
||||
integration = await loader.async_get_integration(hass, self.domain)
|
||||
component = await integration.async_get_component()
|
||||
supports_migrate = hasattr(component, "async_migrate_entry")
|
||||
if not supports_migrate:
|
||||
if same_major_version:
|
||||
return True
|
||||
_LOGGER.error(
|
||||
@@ -806,11 +801,6 @@ class ConfigEntry:
|
||||
)
|
||||
return False
|
||||
|
||||
if not (integration := self._integration_for_domain):
|
||||
integration = await loader.async_get_integration(hass, self.domain)
|
||||
|
||||
component = await integration.async_get_component()
|
||||
|
||||
try:
|
||||
result = await component.async_migrate_entry(hass, self)
|
||||
if not isinstance(result, bool):
|
||||
|
||||
Reference in New Issue
Block a user