mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-04-02 00:07:16 +01:00
Deprecate advanced mode option in addon config (#6614)
* Deprecate advanced mode option in addon config * Note deprecation of field in addon info and list APIs * Update docstring per copilot
This commit is contained in:
@@ -13,7 +13,6 @@ from awesomeversion import AwesomeVersion, AwesomeVersionException
|
||||
|
||||
from ..const import (
|
||||
ARCH_DEPRECATED,
|
||||
ATTR_ADVANCED,
|
||||
ATTR_APPARMOR,
|
||||
ATTR_ARCH,
|
||||
ATTR_AUDIO,
|
||||
@@ -255,8 +254,10 @@ class AddonModel(JobGroup, ABC):
|
||||
|
||||
@property
|
||||
def advanced(self) -> bool:
|
||||
"""Return advanced mode of add-on."""
|
||||
return self.data[ATTR_ADVANCED]
|
||||
"""Return False; advanced mode is deprecated and no longer supported."""
|
||||
# Deprecated since Supervisor 2026.03.0; always returns False and can be
|
||||
# removed once that version is the minimum supported.
|
||||
return False
|
||||
|
||||
@property
|
||||
def stage(self) -> AddonStage:
|
||||
|
||||
@@ -192,6 +192,15 @@ def _warn_addon_config(config: dict[str, Any]):
|
||||
if not name:
|
||||
raise vol.Invalid("Invalid Add-on config!")
|
||||
|
||||
if ATTR_ADVANCED in config:
|
||||
# Deprecated since Supervisor 2026.03.0; this field is ignored and the
|
||||
# warning can be removed once that version is the minimum supported.
|
||||
_LOGGER.warning(
|
||||
"Add-on '%s' uses deprecated 'advanced' field in config. "
|
||||
"This field is ignored by the Supervisor. Please report this to the maintainer.",
|
||||
name,
|
||||
)
|
||||
|
||||
if config.get(ATTR_FULL_ACCESS, False) and (
|
||||
config.get(ATTR_DEVICES)
|
||||
or config.get(ATTR_UART)
|
||||
|
||||
@@ -187,7 +187,7 @@ class APIAddons(CoreSysAttributes):
|
||||
ATTR_NAME: addon.name,
|
||||
ATTR_SLUG: addon.slug,
|
||||
ATTR_DESCRIPTON: addon.description,
|
||||
ATTR_ADVANCED: addon.advanced,
|
||||
ATTR_ADVANCED: addon.advanced, # Deprecated 2026.03
|
||||
ATTR_STAGE: addon.stage,
|
||||
ATTR_VERSION: addon.version,
|
||||
ATTR_VERSION_LATEST: addon.latest_version,
|
||||
@@ -224,7 +224,7 @@ class APIAddons(CoreSysAttributes):
|
||||
ATTR_DNS: addon.dns,
|
||||
ATTR_DESCRIPTON: addon.description,
|
||||
ATTR_LONG_DESCRIPTION: await addon.long_description(),
|
||||
ATTR_ADVANCED: addon.advanced,
|
||||
ATTR_ADVANCED: addon.advanced, # Deprecated 2026.03
|
||||
ATTR_STAGE: addon.stage,
|
||||
ATTR_REPOSITORY: addon.repository,
|
||||
ATTR_VERSION_LATEST: addon.latest_version,
|
||||
|
||||
@@ -18,7 +18,7 @@ from supervisor.addons.addon import Addon
|
||||
from supervisor.addons.const import AddonBackupMode
|
||||
from supervisor.addons.model import AddonModel
|
||||
from supervisor.config import CoreConfig
|
||||
from supervisor.const import AddonBoot, AddonState, BusEvent
|
||||
from supervisor.const import ATTR_ADVANCED, AddonBoot, AddonState, BusEvent
|
||||
from supervisor.coresys import CoreSys
|
||||
from supervisor.docker.addon import DockerAddon
|
||||
from supervisor.docker.const import ContainerState
|
||||
@@ -834,6 +834,14 @@ def test_auto_update_available(install_addon_example: Addon):
|
||||
assert install_addon_example.auto_update_available is False
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("coresys")
|
||||
def test_advanced_flag_ignored(install_addon_example: Addon):
|
||||
"""Ensure advanced flag in config is ignored."""
|
||||
install_addon_example.data[ATTR_ADVANCED] = True
|
||||
|
||||
assert install_addon_example.advanced is False
|
||||
|
||||
|
||||
async def test_paths_cache(coresys: CoreSys, install_addon_ssh: Addon):
|
||||
"""Test cache for key paths that may or may not exist."""
|
||||
assert not install_addon_ssh.with_logo
|
||||
|
||||
@@ -223,6 +223,16 @@ def test_warn_legacy_machine_values(caplog: pytest.LogCaptureFixture):
|
||||
assert "Add-on config 'machine' uses deprecated values" in caplog.text
|
||||
|
||||
|
||||
def test_warn_advanced_deprecated(caplog: pytest.LogCaptureFixture):
|
||||
"""Warn when deprecated advanced field is present."""
|
||||
config = load_json_fixture("basic-addon-config.json")
|
||||
config["advanced"] = True
|
||||
|
||||
vd.SCHEMA_ADDON_CONFIG(config)
|
||||
|
||||
assert "uses deprecated 'advanced' field in config" in caplog.text
|
||||
|
||||
|
||||
async def test_valid_manifest_build():
|
||||
"""Validate build config with manifest build from."""
|
||||
config = load_json_fixture("build-config-manifest.json")
|
||||
|
||||
Reference in New Issue
Block a user