Avoid trying to load platform that are known to not exist in async_prepare_setup_platform (#114659)

This commit is contained in:
J. Nick Koston 2024-04-02 11:22:40 -10:00 committed by Franck Nijhof
parent 02dee34338
commit 639c4a843b
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 6 additions and 0 deletions

View File

@ -504,6 +504,12 @@ async def async_prepare_setup_platform(
log_error(f"Unable to import the component ({exc}).")
return None
if not integration.platforms_exists((domain,)):
log_error(
f"Platform not found (No module named '{integration.pkg_path}.{domain}')"
)
return None
try:
platform = await integration.async_get_platform(domain)
except ImportError as exc: