From 1793944203555f2c9e32c54642e2a3928c9a865b Mon Sep 17 00:00:00 2001 From: Mike Degatano Date: Tue, 27 Aug 2024 15:20:07 +0000 Subject: [PATCH] `manual_forced` to `manual_only` --- supervisor/addons/addon.py | 2 +- supervisor/api/addons.py | 2 +- supervisor/const.py | 4 ++-- tests/addons/test_addon.py | 6 +++--- tests/api/test_addons.py | 8 ++++---- tests/fixtures/addons/local/example/config.yaml | 2 +- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/supervisor/addons/addon.py b/supervisor/addons/addon.py index 54901a9977d..f1680bf81b3 100644 --- a/supervisor/addons/addon.py +++ b/supervisor/addons/addon.py @@ -313,7 +313,7 @@ def options(self, value: dict[str, Any] | None) -> None: @property def boot(self) -> AddonBoot: """Return boot config with prio local settings unless config is forced.""" - if self.boot_config == AddonBootConfig.MANUAL_FORCED: + if self.boot_config == AddonBootConfig.MANUAL_ONLY: return super().boot return self.persist.get(ATTR_BOOT, super().boot) diff --git a/supervisor/api/addons.py b/supervisor/api/addons.py index feba4752209..6c9cad1cce6 100644 --- a/supervisor/api/addons.py +++ b/supervisor/api/addons.py @@ -302,7 +302,7 @@ async def options(self, request: web.Request) -> None: if ATTR_OPTIONS in body: addon.options = body[ATTR_OPTIONS] if ATTR_BOOT in body: - if addon.boot_config == AddonBootConfig.MANUAL_FORCED: + if addon.boot_config == AddonBootConfig.MANUAL_ONLY: raise APIError( f"Addon {addon.slug} boot option is set to {addon.boot_config} so it cannot be changed" ) diff --git a/supervisor/const.py b/supervisor/const.py index f8b55b22390..6f4ffb219ad 100644 --- a/supervisor/const.py +++ b/supervisor/const.py @@ -387,7 +387,7 @@ class AddonBootConfig(StrEnum): AUTO = "auto" MANUAL = "manual" - MANUAL_FORCED = "manual_forced" + MANUAL_ONLY = "manual_only" class AddonBoot(StrEnum): @@ -399,7 +399,7 @@ class AddonBoot(StrEnum): @classmethod def _missing_(cls, value: str) -> Self | None: """Convert 'forced' config values to their counterpart.""" - if value == AddonBootConfig.MANUAL_FORCED: + if value == AddonBootConfig.MANUAL_ONLY: return AddonBoot.MANUAL return None diff --git a/tests/addons/test_addon.py b/tests/addons/test_addon.py index d04764da0b3..7ee520a61d4 100644 --- a/tests/addons/test_addon.py +++ b/tests/addons/test_addon.py @@ -886,9 +886,9 @@ async def test_addon_load_succeeds_with_docker_errors( assert "Unknown error with test/amd64-addon-ssh:9.2.1" in caplog.text -async def test_addon_manual_forced_boot(coresys: CoreSys, install_addon_example: Addon): - """Test an addon with manual forced boot mode.""" - assert install_addon_example.boot_config == "manual_forced" +async def test_addon_manual_only_boot(coresys: CoreSys, install_addon_example: Addon): + """Test an addon with manual only boot mode.""" + assert install_addon_example.boot_config == "manual_only" assert install_addon_example.boot == "manual" # Users cannot change boot mode of an addon with manual forced so changing boot isn't realistic diff --git a/tests/api/test_addons.py b/tests/api/test_addons.py index 9ea5c345adf..1e7ed79c4dd 100644 --- a/tests/api/test_addons.py +++ b/tests/api/test_addons.py @@ -348,21 +348,21 @@ async def test_api_addon_system_managed( assert body["data"]["system_managed_config_entry"] is None -async def test_addon_options_boot_mode_forced_invalid( +async def test_addon_options_boot_mode_manual_only_invalid( api_client: TestClient, install_addon_example: Addon ): - """Test changing boot mode is invalid if set to manual forced.""" + """Test changing boot mode is invalid if set to manual only.""" install_addon_example.data["ingress"] = False resp = await api_client.get("/addons/local_example/info") assert resp.status == 200 body = await resp.json() assert body["data"]["boot"] == "manual" - assert body["data"]["boot_config"] == "manual_forced" + assert body["data"]["boot_config"] == "manual_only" resp = await api_client.post("/addons/local_example/options", json={"boot": "auto"}) assert resp.status == 400 body = await resp.json() assert ( body["message"] - == "Addon local_example boot option is set to manual_forced so it cannot be changed" + == "Addon local_example boot option is set to manual_only so it cannot be changed" ) diff --git a/tests/fixtures/addons/local/example/config.yaml b/tests/fixtures/addons/local/example/config.yaml index 3ca0c1561cd..ab94374ae7b 100644 --- a/tests/fixtures/addons/local/example/config.yaml +++ b/tests/fixtures/addons/local/example/config.yaml @@ -23,4 +23,4 @@ ingress_port: 0 breaking_versions: - test - 1.0 -boot: manual_forced +boot: manual_only