mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-07-23 17:16:33 +00:00
Do not backup add-on being uninstalled (#5917)
This commit is contained in:
parent
5285e60cd3
commit
63fde3b410
@ -1335,6 +1335,13 @@ class Addon(AddonModel):
|
|||||||
|
|
||||||
wait_for_start: asyncio.Task | None = None
|
wait_for_start: asyncio.Task | None = None
|
||||||
|
|
||||||
|
# Refuse to backup if add-on is unknown (e.g. has been uninstalled by the user
|
||||||
|
# since the backup got started).
|
||||||
|
if self.state == AddonState.UNKNOWN:
|
||||||
|
raise AddonsError(
|
||||||
|
f"Add-on {self.slug} is not installed, cannot backup!", _LOGGER.error
|
||||||
|
)
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
ATTR_USER: self.persist,
|
ATTR_USER: self.persist,
|
||||||
ATTR_SYSTEM: self.data,
|
ATTR_SYSTEM: self.data,
|
||||||
|
@ -102,7 +102,7 @@ async def test_addon_state_listener(coresys: CoreSys, install_addon_ssh: Addon)
|
|||||||
with patch.object(DockerAddon, "attach"):
|
with patch.object(DockerAddon, "attach"):
|
||||||
await install_addon_ssh.load()
|
await install_addon_ssh.load()
|
||||||
|
|
||||||
assert install_addon_ssh.state == AddonState.UNKNOWN
|
assert install_addon_ssh.state == AddonState.STOPPED
|
||||||
|
|
||||||
with patch.object(Addon, "watchdog_container"):
|
with patch.object(Addon, "watchdog_container"):
|
||||||
_fire_test_event(coresys, f"addon_{TEST_ADDON_SLUG}", ContainerState.RUNNING)
|
_fire_test_event(coresys, f"addon_{TEST_ADDON_SLUG}", ContainerState.RUNNING)
|
||||||
|
@ -40,6 +40,7 @@ from supervisor.const import (
|
|||||||
ATTR_TYPE,
|
ATTR_TYPE,
|
||||||
ATTR_VERSION,
|
ATTR_VERSION,
|
||||||
REQUEST_FROM,
|
REQUEST_FROM,
|
||||||
|
AddonState,
|
||||||
CoreState,
|
CoreState,
|
||||||
)
|
)
|
||||||
from supervisor.coresys import CoreSys
|
from supervisor.coresys import CoreSys
|
||||||
@ -615,6 +616,7 @@ async def install_addon_ssh(coresys: CoreSys, repository):
|
|||||||
coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data)
|
coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data)
|
||||||
|
|
||||||
addon = Addon(coresys, store.slug)
|
addon = Addon(coresys, store.slug)
|
||||||
|
addon.state = AddonState.STOPPED
|
||||||
coresys.addons.local[addon.slug] = addon
|
coresys.addons.local[addon.slug] = addon
|
||||||
yield addon
|
yield addon
|
||||||
|
|
||||||
@ -627,6 +629,7 @@ async def install_addon_example(coresys: CoreSys, repository):
|
|||||||
coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data)
|
coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data)
|
||||||
|
|
||||||
addon = Addon(coresys, store.slug)
|
addon = Addon(coresys, store.slug)
|
||||||
|
addon.state = AddonState.STOPPED
|
||||||
coresys.addons.local[addon.slug] = addon
|
coresys.addons.local[addon.slug] = addon
|
||||||
yield addon
|
yield addon
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user