Cleanup ingress panel on add-on uninstall (#1220)

* Cleanup ingress panel on add-on uninstall

* Update __init__.py
This commit is contained in:
Franck Nijhof 2019-08-15 23:05:04 +02:00 committed by Pascal Vizeli
parent 35033d1f76
commit b5ed6c586a

View File

@ -11,6 +11,7 @@ from ..exceptions import (
AddonsError, AddonsError,
AddonsNotSupportedError, AddonsNotSupportedError,
DockerAPIError, DockerAPIError,
HomeAssistantAPIError,
HostAppArmorError, HostAppArmorError,
) )
from ..store.addon import AddonStore from ..store.addon import AddonStore
@ -155,8 +156,15 @@ class AddonManager(CoreSysAttributes):
with suppress(HostAppArmorError): with suppress(HostAppArmorError):
await addon.uninstall_apparmor() await addon.uninstall_apparmor()
# Cleanup Ingress panel from sidebar
if addon.ingress_panel:
addon.ingress_panel = False
with suppress(HomeAssistantAPIError):
await self.sys_ingress.update_hass_panel(addon)
# Cleanup internal data # Cleanup internal data
addon.remove_discovery() addon.remove_discovery()
self.data.uninstall(addon) self.data.uninstall(addon)
self.local.pop(slug) self.local.pop(slug)