mirror of
https://github.com/home-assistant/supervisor.git
synced 2025-12-21 15:28:23 +00:00
* Fix mypy issues in plugins * Fix mypy issues in resolution module * fix misses in resolution check * Fix signatures on evaluate methods * nitpick fix suggestions
39 lines
1.1 KiB
Python
39 lines
1.1 KiB
Python
"""Evaluation class for operating system."""
|
|
|
|
from ...const import CoreState
|
|
from ...coresys import CoreSys
|
|
from ..const import UnsupportedReason
|
|
from .base import EvaluateBase
|
|
|
|
SUPPORTED_OS = ["Debian GNU/Linux 12 (bookworm)"]
|
|
|
|
|
|
def setup(coresys: CoreSys) -> EvaluateBase:
|
|
"""Initialize evaluation-setup function."""
|
|
return EvaluateOperatingSystem(coresys)
|
|
|
|
|
|
class EvaluateOperatingSystem(EvaluateBase):
|
|
"""Evaluate the operating system."""
|
|
|
|
@property
|
|
def reason(self) -> UnsupportedReason:
|
|
"""Return a UnsupportedReason enum."""
|
|
return UnsupportedReason.OS
|
|
|
|
@property
|
|
def on_failure(self) -> str:
|
|
"""Return a string that is printed when self.evaluate is True."""
|
|
return f"Detected unsupported OS: {self.sys_host.info.operating_system}"
|
|
|
|
@property
|
|
def states(self) -> list[CoreState]:
|
|
"""Return a list of valid states when this evaluation can run."""
|
|
return [CoreState.SETUP]
|
|
|
|
async def evaluate(self) -> bool:
|
|
"""Run evaluation."""
|
|
if self.sys_os.available:
|
|
return False
|
|
return self.sys_host.info.operating_system not in SUPPORTED_OS
|