mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-08-08 08:47:42 +00:00
Use actual latest version of OS in os version check (#6067)
This commit is contained in:
parent
f11eb6b35a
commit
059b161f4f
@ -197,6 +197,7 @@ ATTR_GPIO = "gpio"
|
|||||||
ATTR_HASSIO_API = "hassio_api"
|
ATTR_HASSIO_API = "hassio_api"
|
||||||
ATTR_HASSIO_ROLE = "hassio_role"
|
ATTR_HASSIO_ROLE = "hassio_role"
|
||||||
ATTR_HASSOS = "hassos"
|
ATTR_HASSOS = "hassos"
|
||||||
|
ATTR_HASSOS_UNRESTRICTED = "hassos_unrestricted"
|
||||||
ATTR_HEALTHY = "healthy"
|
ATTR_HEALTHY = "healthy"
|
||||||
ATTR_HEARTBEAT_LED = "heartbeat_led"
|
ATTR_HEARTBEAT_LED = "heartbeat_led"
|
||||||
ATTR_HOMEASSISTANT = "homeassistant"
|
ATTR_HOMEASSISTANT = "homeassistant"
|
||||||
|
@ -110,6 +110,11 @@ class OSManager(CoreSysAttributes):
|
|||||||
"""Return version of HassOS."""
|
"""Return version of HassOS."""
|
||||||
return self.sys_updater.version_hassos
|
return self.sys_updater.version_hassos
|
||||||
|
|
||||||
|
@property
|
||||||
|
def latest_version_unrestricted(self) -> AwesomeVersion | None:
|
||||||
|
"""Return current latest version of HassOS for board ignoring upgrade restrictions."""
|
||||||
|
return self.sys_updater.version_hassos_unrestricted
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def need_update(self) -> bool:
|
def need_update(self) -> bool:
|
||||||
"""Return true if a HassOS update is available."""
|
"""Return true if a HassOS update is available."""
|
||||||
|
@ -38,7 +38,7 @@ class EvaluateOSVersion(EvaluateBase):
|
|||||||
if (
|
if (
|
||||||
not self.sys_os.available
|
not self.sys_os.available
|
||||||
or not (current := self.sys_os.version)
|
or not (current := self.sys_os.version)
|
||||||
or not (latest := self.sys_os.latest_version)
|
or not (latest := self.sys_os.latest_version_unrestricted)
|
||||||
or not latest.major
|
or not latest.major
|
||||||
):
|
):
|
||||||
return False
|
return False
|
||||||
|
@ -18,6 +18,7 @@ from .const import (
|
|||||||
ATTR_CLI,
|
ATTR_CLI,
|
||||||
ATTR_DNS,
|
ATTR_DNS,
|
||||||
ATTR_HASSOS,
|
ATTR_HASSOS,
|
||||||
|
ATTR_HASSOS_UNRESTRICTED,
|
||||||
ATTR_HOMEASSISTANT,
|
ATTR_HOMEASSISTANT,
|
||||||
ATTR_IMAGE,
|
ATTR_IMAGE,
|
||||||
ATTR_MULTICAST,
|
ATTR_MULTICAST,
|
||||||
@ -84,6 +85,11 @@ class Updater(FileConfiguration, CoreSysAttributes):
|
|||||||
"""Return latest version of HassOS."""
|
"""Return latest version of HassOS."""
|
||||||
return self._data.get(ATTR_HASSOS)
|
return self._data.get(ATTR_HASSOS)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def version_hassos_unrestricted(self) -> AwesomeVersion | None:
|
||||||
|
"""Return latest version of HassOS ignoring upgrade restrictions."""
|
||||||
|
return self._data.get(ATTR_HASSOS_UNRESTRICTED)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def version_cli(self) -> AwesomeVersion | None:
|
def version_cli(self) -> AwesomeVersion | None:
|
||||||
"""Return latest version of CLI."""
|
"""Return latest version of CLI."""
|
||||||
@ -275,6 +281,7 @@ class Updater(FileConfiguration, CoreSysAttributes):
|
|||||||
if self.sys_os.board:
|
if self.sys_os.board:
|
||||||
self._data[ATTR_OTA] = data["ota"]
|
self._data[ATTR_OTA] = data["ota"]
|
||||||
if version := data["hassos"].get(self.sys_os.board):
|
if version := data["hassos"].get(self.sys_os.board):
|
||||||
|
self._data[ATTR_HASSOS_UNRESTRICTED] = version
|
||||||
events.append("os")
|
events.append("os")
|
||||||
upgrade_map = data.get("hassos-upgrade", {})
|
upgrade_map = data.get("hassos-upgrade", {})
|
||||||
if last_in_major := upgrade_map.get(str(self.sys_os.version.major)):
|
if last_in_major := upgrade_map.get(str(self.sys_os.version.major)):
|
||||||
|
@ -23,6 +23,7 @@ from .const import (
|
|||||||
ATTR_ENABLE_IPV6,
|
ATTR_ENABLE_IPV6,
|
||||||
ATTR_FORCE_SECURITY,
|
ATTR_FORCE_SECURITY,
|
||||||
ATTR_HASSOS,
|
ATTR_HASSOS,
|
||||||
|
ATTR_HASSOS_UNRESTRICTED,
|
||||||
ATTR_HOMEASSISTANT,
|
ATTR_HOMEASSISTANT,
|
||||||
ATTR_ID,
|
ATTR_ID,
|
||||||
ATTR_IMAGE,
|
ATTR_IMAGE,
|
||||||
@ -126,6 +127,7 @@ SCHEMA_UPDATER_CONFIG = vol.Schema(
|
|||||||
vol.Optional(ATTR_HOMEASSISTANT): version_tag,
|
vol.Optional(ATTR_HOMEASSISTANT): version_tag,
|
||||||
vol.Optional(ATTR_SUPERVISOR): version_tag,
|
vol.Optional(ATTR_SUPERVISOR): version_tag,
|
||||||
vol.Optional(ATTR_HASSOS): version_tag,
|
vol.Optional(ATTR_HASSOS): version_tag,
|
||||||
|
vol.Optional(ATTR_HASSOS_UNRESTRICTED): version_tag,
|
||||||
vol.Optional(ATTR_CLI): version_tag,
|
vol.Optional(ATTR_CLI): version_tag,
|
||||||
vol.Optional(ATTR_DNS): version_tag,
|
vol.Optional(ATTR_DNS): version_tag,
|
||||||
vol.Optional(ATTR_AUDIO): version_tag,
|
vol.Optional(ATTR_AUDIO): version_tag,
|
||||||
|
@ -49,7 +49,7 @@ async def test_os_version_evaluation(
|
|||||||
),
|
),
|
||||||
patch.object(
|
patch.object(
|
||||||
OSManager,
|
OSManager,
|
||||||
"latest_version",
|
"latest_version_unrestricted",
|
||||||
new=PropertyMock(return_value=latest and AwesomeVersion(latest)),
|
new=PropertyMock(return_value=latest and AwesomeVersion(latest)),
|
||||||
),
|
),
|
||||||
):
|
):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user