Skip to content

Commit c4cedda

Browse files
committed
Use Home Assistant Core instead of just Core
Avoid any ambiguity in what is exactly outdated/unsupported by using Home Assistant Core instead of just Core.
1 parent 09e2322 commit c4cedda

File tree

9 files changed

+25
-21
lines changed

9 files changed

+25
-21
lines changed

supervisor/jobs/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class JobCondition(StrEnum):
2020
"""Job condition enum."""
2121

2222
AUTO_UPDATE = "auto_update"
23-
CORE_SUPPORTED = "core_supported"
23+
HOME_ASSISTANT_CORE_SUPPORTED = "home_assistant_core_supported"
2424
FREE_SPACE = "free_space"
2525
FROZEN = "frozen"
2626
HAOS = "haos"

supervisor/jobs/decorator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -405,8 +405,9 @@ async def check_conditions(
405405
)
406406

407407
if (
408-
JobCondition.CORE_SUPPORTED in used_conditions
409-
and UnsupportedReason.CORE_VERSION in coresys.sys_resolution.unsupported
408+
JobCondition.HOME_ASSISTANT_CORE_SUPPORTED in used_conditions
409+
and UnsupportedReason.HOME_ASSISTANT_CORE_VERSION
410+
in coresys.sys_resolution.unsupported
410411
):
411412
raise JobConditionException(
412413
f"'{method_name}' blocked from execution, unsupported Home Assistant Core version"

supervisor/misc/tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ async def _watchdog_addon_application(self):
361361
conditions=[
362362
JobCondition.SUPERVISOR_UPDATED,
363363
JobCondition.OS_SUPPORTED,
364-
JobCondition.CORE_SUPPORTED,
364+
JobCondition.HOME_ASSISTANT_CORE_SUPPORTED,
365365
],
366366
)
367367
async def _reload_store(self) -> None:

supervisor/resolution/const.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class UnsupportedReason(StrEnum):
4040
CGROUP_VERSION = "cgroup_version"
4141
CONNECTIVITY_CHECK = "connectivity_check"
4242
CONTENT_TRUST = "content_trust"
43-
CORE_VERSION = "core_version"
43+
HOME_ASSISTANT_CORE_VERSION = "home_assistant_core_version"
4444
DBUS = "dbus"
4545
DNS_SERVER = "dns_server"
4646
DOCKER_CONFIGURATION = "docker_configuration"

supervisor/resolution/evaluations/core_version.py renamed to supervisor/resolution/evaluations/home_assistant_core_version.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919

2020
def setup(coresys: CoreSys) -> EvaluateBase:
2121
"""Initialize evaluation-setup function."""
22-
return EvaluateCoreVersion(coresys)
22+
return EvaluateHomeAssistantCoreVersion(coresys)
2323

2424

25-
class EvaluateCoreVersion(EvaluateBase):
25+
class EvaluateHomeAssistantCoreVersion(EvaluateBase):
2626
"""Evaluate the Home Assistant Core version."""
2727

2828
@property
2929
def reason(self) -> UnsupportedReason:
3030
"""Return a UnsupportedReason enum."""
31-
return UnsupportedReason.CORE_VERSION
31+
return UnsupportedReason.HOME_ASSISTANT_CORE_VERSION
3232

3333
@property
3434
def on_failure(self) -> str:

supervisor/store/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async def load(self) -> None:
7777
conditions=[
7878
JobCondition.SUPERVISOR_UPDATED,
7979
JobCondition.OS_SUPPORTED,
80-
JobCondition.CORE_SUPPORTED,
80+
JobCondition.HOME_ASSISTANT_CORE_SUPPORTED,
8181
],
8282
on_condition=StoreJobError,
8383
)
@@ -121,7 +121,7 @@ async def reload(self, repository: Repository | None = None) -> None:
121121
JobCondition.INTERNET_SYSTEM,
122122
JobCondition.SUPERVISOR_UPDATED,
123123
JobCondition.OS_SUPPORTED,
124-
JobCondition.CORE_SUPPORTED,
124+
JobCondition.HOME_ASSISTANT_CORE_SUPPORTED,
125125
],
126126
on_condition=StoreJobError,
127127
)

supervisor/updater.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ async def _check_connectivity(self, connectivity: bool):
250250
conditions=[
251251
JobCondition.INTERNET_SYSTEM,
252252
JobCondition.OS_SUPPORTED,
253-
JobCondition.CORE_SUPPORTED,
253+
JobCondition.HOME_ASSISTANT_CORE_SUPPORTED,
254254
],
255255
on_condition=UpdaterJobError,
256256
throttle_period=timedelta(seconds=30),

tests/jobs/test_job_decorator.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,7 +1397,8 @@ def __init__(self, coresys: CoreSys):
13971397
self.coresys = coresys
13981398

13991399
@Job(
1400-
name="test_core_supported_execute", conditions=[JobCondition.CORE_SUPPORTED]
1400+
name="test_core_supported_execute",
1401+
conditions=[JobCondition.HOME_ASSISTANT_CORE_SUPPORTED],
14011402
)
14021403
async def execute(self):
14031404
"""Execute the class method."""
@@ -1406,11 +1407,11 @@ async def execute(self):
14061407
test = TestClass(coresys)
14071408
assert await test.execute()
14081409

1409-
coresys.resolution.unsupported.append(UnsupportedReason.CORE_VERSION)
1410+
coresys.resolution.unsupported.append(UnsupportedReason.HOME_ASSISTANT_CORE_VERSION)
14101411
assert not await test.execute()
14111412
assert (
14121413
"blocked from execution, unsupported Home Assistant Core version" in caplog.text
14131414
)
14141415

1415-
coresys.jobs.ignore_conditions = [JobCondition.CORE_SUPPORTED]
1416+
coresys.jobs.ignore_conditions = [JobCondition.HOME_ASSISTANT_CORE_SUPPORTED]
14161417
assert await test.execute()

tests/resolution/evaluation/test_evaluate_core_version.py renamed to tests/resolution/evaluation/test_evaluate_home_assistant_core_version.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
from supervisor.coresys import CoreSys
1010
from supervisor.homeassistant.const import LANDINGPAGE
1111
from supervisor.homeassistant.module import HomeAssistant
12-
from supervisor.resolution.evaluations.core_version import EvaluateCoreVersion
12+
from supervisor.resolution.evaluations.home_assistant_core_version import (
13+
EvaluateHomeAssistantCoreVersion,
14+
)
1315

1416

1517
@pytest.mark.parametrize(
@@ -38,7 +40,7 @@ async def test_core_version_evaluation(
3840
coresys: CoreSys, current: str | None, latest: str | None, expected: bool
3941
):
4042
"""Test evaluation logic on Core versions."""
41-
evaluation = EvaluateCoreVersion(coresys)
43+
evaluation = EvaluateHomeAssistantCoreVersion(coresys)
4244
await coresys.core.set_state(CoreState.RUNNING)
4345

4446
with (
@@ -60,7 +62,7 @@ async def test_core_version_evaluation(
6062

6163
async def test_core_version_evaluation_no_latest(coresys: CoreSys):
6264
"""Test evaluation when no latest version is available."""
63-
evaluation = EvaluateCoreVersion(coresys)
65+
evaluation = EvaluateHomeAssistantCoreVersion(coresys)
6466
await coresys.core.set_state(CoreState.RUNNING)
6567

6668
with (
@@ -83,7 +85,7 @@ async def test_core_version_evaluation_no_latest(coresys: CoreSys):
8385

8486
async def test_core_version_invalid_format(coresys: CoreSys):
8587
"""Test evaluation with invalid version format."""
86-
evaluation = EvaluateCoreVersion(coresys)
88+
evaluation = EvaluateHomeAssistantCoreVersion(coresys)
8789
await coresys.core.set_state(CoreState.RUNNING)
8890

8991
with (
@@ -106,7 +108,7 @@ async def test_core_version_invalid_format(coresys: CoreSys):
106108

107109
async def test_core_version_landingpage(coresys: CoreSys):
108110
"""Test evaluation with landingpage version."""
109-
evaluation = EvaluateCoreVersion(coresys)
111+
evaluation = EvaluateHomeAssistantCoreVersion(coresys)
110112
await coresys.core.set_state(CoreState.RUNNING)
111113

112114
with (
@@ -129,14 +131,14 @@ async def test_core_version_landingpage(coresys: CoreSys):
129131

130132
async def test_did_run(coresys: CoreSys):
131133
"""Test that the evaluation ran as expected."""
132-
evaluation = EvaluateCoreVersion(coresys)
134+
evaluation = EvaluateHomeAssistantCoreVersion(coresys)
133135
should_run = evaluation.states
134136
should_not_run = [state for state in CoreState if state not in should_run]
135137
assert len(should_run) != 0
136138
assert len(should_not_run) != 0
137139

138140
with patch(
139-
"supervisor.resolution.evaluations.core_version.EvaluateCoreVersion.evaluate",
141+
"supervisor.resolution.evaluations.home_assistant_core_version.EvaluateHomeAssistantCoreVersion.evaluate",
140142
return_value=None,
141143
) as evaluate:
142144
for state in should_run:

0 commit comments

Comments
 (0)