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 KostonandPaulus Schoutsen authored and GitHub committed 2020-05-25 15:40:06 -04:00
1 parent ba120d4220
commit d2a92ce4f3
2 files changed
+40 -2

No files matched your search

+18 -2
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