Skip to content

Commit ad2d6a3

Browse files
authored
Revert "Do not backup add-on being uninstalled (#5917)" (#5925)
This reverts commit 63fde3b. 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
1 parent 42f8855 commit ad2d6a3

File tree

3 files changed

+1
-11
lines changed

3 files changed

+1
-11
lines changed

supervisor/addons/addon.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,13 +1335,6 @@ def _addon_backup(
13351335

13361336
wait_for_start: asyncio.Task | None = None
13371337

1338-
# Refuse to backup if add-on is unknown (e.g. has been uninstalled by the user
1339-
# since the backup got started).
1340-
if self.state == AddonState.UNKNOWN:
1341-
raise AddonsError(
1342-
f"Add-on {self.slug} is not installed, cannot backup!", _LOGGER.error
1343-
)
1344-
13451338
data = {
13461339
ATTR_USER: self.persist,
13471340
ATTR_SYSTEM: self.data,

tests/addons/test_addon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async def test_addon_state_listener(coresys: CoreSys, install_addon_ssh: Addon)
102102
with patch.object(DockerAddon, "attach"):
103103
await install_addon_ssh.load()
104104

105-
assert install_addon_ssh.state == AddonState.STOPPED
105+
assert install_addon_ssh.state == AddonState.UNKNOWN
106106

107107
with patch.object(Addon, "watchdog_container"):
108108
_fire_test_event(coresys, f"addon_{TEST_ADDON_SLUG}", ContainerState.RUNNING)

tests/conftest.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
ATTR_TYPE,
4141
ATTR_VERSION,
4242
REQUEST_FROM,
43-
AddonState,
4443
CoreState,
4544
)
4645
from supervisor.coresys import CoreSys
@@ -632,7 +631,6 @@ async def install_addon_ssh(coresys: CoreSys, repository):
632631
coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data)
633632

634633
addon = Addon(coresys, store.slug)
635-
addon.state = AddonState.STOPPED
636634
coresys.addons.local[addon.slug] = addon
637635
yield addon
638636

@@ -645,7 +643,6 @@ async def install_addon_example(coresys: CoreSys, repository):
645643
coresys.addons.data._data = coresys.addons.data._schema(coresys.addons.data._data)
646644

647645
addon = Addon(coresys, store.slug)
648-
addon.state = AddonState.STOPPED
649646
coresys.addons.local[addon.slug] = addon
650647
yield addon
651648

0 commit comments

Comments
 (0)