From ad2d6a3156a520bd865a37fd26b7ea1b36181781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20=C4=8Cerm=C3=A1k?= Date: Thu, 29 May 2025 17:32:51 +0200 Subject: [PATCH] Revert "Do not backup add-on being uninstalled (#5917)" (#5925) This reverts commit 63fde3b4109310e95ebdcc8e3c23a04ff96ba592. This change introduced another more severe regression, causing all add-ons that haven't been started since Supervisor startup to cause errors during their backup. More sophisticated check would have to be implemented to address edge cases during backups for non-existing add-ons (or their config actually). Fixes #5924 --- supervisor/addons/addon.py | 7 ------- tests/addons/test_addon.py | 2 +- tests/conftest.py | 3 --- 3 files changed, 1 insertion(+), 11 deletions(-) diff --git a/supervisor/addons/addon.py b/supervisor/addons/addon.py index eb440b961..2546a31f4 100644 --- a/supervisor/addons/addon.py +++ b/supervisor/addons/addon.py @@ -1335,13 +1335,6 @@ class Addon(AddonModel): 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 = { ATTR_USER: self.persist, ATTR_SYSTEM: self.data, diff --git a/tests/addons/test_addon.py b/tests/addons/test_addon.py index 7fc406a1b..8bf89fcc2 100644 --- a/tests/addons/test_addon.py +++ b/tests/addons/test_addon.py @@ -102,7 +102,7 @@ async def test_addon_state_listener(coresys: CoreSys, install_addon_ssh: Addon) with patch.object(DockerAddon, "attach"): await install_addon_ssh.load() - assert install_addon_ssh.state == AddonState.STOPPED + assert install_addon_ssh.state == AddonState.UNKNOWN with patch.object(Addon, "watchdog_container"): _fire_test_event(coresys, f"addon_{TEST_ADDON_SLUG}", ContainerState.RUNNING) diff --git a/tests/conftest.py b/tests/conftest.py index 6d74854cb..dd82c752d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -40,7 +40,6 @@ from supervisor.const import ( ATTR_TYPE, ATTR_VERSION, REQUEST_FROM, - AddonState, CoreState, ) from supervisor.coresys import CoreSys @@ -632,7 +631,6 @@ async def install_addon_ssh(coresys: CoreSys, repository): coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data) addon = Addon(coresys, store.slug) - addon.state = AddonState.STOPPED coresys.addons.local[addon.slug] = addon yield addon @@ -645,7 +643,6 @@ async def install_addon_example(coresys: CoreSys, repository): coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data) addon = Addon(coresys, store.slug) - addon.state = AddonState.STOPPED coresys.addons.local[addon.slug] = addon yield addon