1
0
mirror of https://github.com/home-assistant/core.git synced 2025-12-24 21:06:19 +00:00

Ensure a deleted integration can be removed (#36130)

* Ensure a deleted intergration can be removed

* Update homeassistant/config_entries.py

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>

Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
J. Nick Koston
2020-05-25 14:40:06 -05:00
committed by GitHub
parent ba120d4220
commit d2a92ce4f3
2 changed files with 40 additions and 2 deletions

View File

@@ -268,7 +268,15 @@ class ConfigEntry:
return True
if integration is None:
integration = await loader.async_get_integration(hass, self.domain)
try:
integration = await loader.async_get_integration(hass, self.domain)
except loader.IntegrationNotFound:
# The integration was likely a custom_component
# that was uninstalled, or an integration
# that has been renamed without removing the config
# entry.
self.state = ENTRY_STATE_NOT_LOADED
return True
component = integration.get_component()
@@ -316,7 +324,15 @@ class ConfigEntry:
if self.source == SOURCE_IGNORE:
return
integration = await loader.async_get_integration(hass, self.domain)
try:
integration = await loader.async_get_integration(hass, self.domain)
except loader.IntegrationNotFound:
# The integration was likely a custom_component
# that was uninstalled, or an integration
# that has been renamed without removing the config
# entry.
return
component = integration.get_component()
if not hasattr(component, "async_remove_entry"):
return