Compare commits

...

8 Commits

Author SHA1 Message Date
Petar Petrov
906838e325 Fix disk usage calculation (#6339) 2025-11-24 16:35:13 +02:00
Stefan Agner
3be0c13fc5 Drop Debian 12 from supported OS list (#6337)
* Drop Debian 12 from supported OS list

With the deprecation of Home Assistant Supervised installation method
Debian 12 is no longer supported. This change removes Debian 12
from the list of supported operating systems in the evaluation logic.

* Improve tests
2025-11-24 11:46:23 +01:00
dependabot[bot]
bb450cad4f Bump peter-evans/create-pull-request from 7.0.8 to 7.0.9 (#6332)
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 7.0.8 to 7.0.9.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](271a8d0340...84ae59a2cd)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-version: 7.0.9
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 08:52:46 +01:00
dependabot[bot]
10af48a65b Bump backports-zstd from 1.0.0 to 1.1.0 (#6336)
Bumps [backports-zstd](https://github.com/rogdham/backports.zstd) from 1.0.0 to 1.1.0.
- [Changelog](https://github.com/Rogdham/backports.zstd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rogdham/backports.zstd/compare/v1.0.0...v1.1.0)

---
updated-dependencies:
- dependency-name: backports-zstd
  dependency-version: 1.1.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 08:50:56 +01:00
dependabot[bot]
2f334c48c3 Bump ruff from 0.14.5 to 0.14.6 (#6335)
Bumps [ruff](https://github.com/astral-sh/ruff) from 0.14.5 to 0.14.6.
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](https://github.com/astral-sh/ruff/compare/0.14.5...0.14.6)

---
updated-dependencies:
- dependency-name: ruff
  dependency-version: 0.14.6
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 08:49:55 +01:00
dependabot[bot]
6d87e8f591 Bump pre-commit from 4.4.0 to 4.5.0 (#6334) 2025-11-24 07:54:42 +01:00
dependabot[bot]
4d1dd63248 Bump time-machine from 3.0.0 to 3.1.0 (#6333) 2025-11-24 07:46:27 +01:00
Stefan Agner
0c2d0cf5c1 Fix D-Bus enum type conversions for NetworkManager (#6325)
Co-authored-by: Claude <noreply@anthropic.com>
2025-11-22 21:52:14 +01:00
11 changed files with 48 additions and 29 deletions

View File

@@ -68,7 +68,7 @@ jobs:
run: |
rm -f supervisor/api/panel/home_assistant_frontend_supervisor-*.tar.gz
- name: Create PR
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
uses: peter-evans/create-pull-request@84ae59a2cdc2258d6fa0732dd66352dddae2a412 # v7.0.9
with:
commit-message: "Update frontend to version ${{ needs.check-version.outputs.latest_version }}"
branch: autoupdate-frontend

View File

@@ -4,7 +4,7 @@ aiohttp==3.13.2
atomicwrites-homeassistant==1.4.1
attrs==25.4.0
awesomeversion==25.8.0
backports.zstd==1.0.0
backports.zstd==1.1.0
blockbuster==1.5.25
brotli==1.2.0
ciso8601==2.3.3

View File

@@ -1,15 +1,15 @@
astroid==4.0.2
coverage==7.12.0
mypy==1.18.2
pre-commit==4.4.0
pre-commit==4.5.0
pylint==4.0.3
pytest-aiohttp==1.1.0
pytest-asyncio==1.3.0
pytest-cov==7.0.0
pytest-timeout==2.4.0
pytest==9.0.1
ruff==0.14.5
time-machine==3.0.0
ruff==0.14.6
time-machine==3.1.0
types-docker==7.1.0.20251009
types-pyyaml==6.0.12.20250915
types-requests==2.32.4.20250913

View File

@@ -343,7 +343,7 @@ class APIHost(CoreSysAttributes):
disk = self.sys_hardware.disk
total, used, _ = await self.sys_run_in_executor(
total, _, free = await self.sys_run_in_executor(
disk.disk_usage, self.sys_config.path_supervisor
)
@@ -365,12 +365,13 @@ class APIHost(CoreSysAttributes):
"id": "root",
"label": "Root",
"total_bytes": total,
"used_bytes": used,
"used_bytes": total - free,
"children": [
{
"id": "system",
"label": "System",
"used_bytes": used
"used_bytes": total
- free
- sum(path["used_bytes"] for path in known_paths),
},
*known_paths,

View File

@@ -306,6 +306,8 @@ class DeviceType(IntEnum):
VLAN = 11
TUN = 16
VETH = 20
WIREGUARD = 29
LOOPBACK = 32
class WirelessMethodType(IntEnum):

View File

@@ -134,9 +134,10 @@ class NetworkManager(DBusInterfaceProxy):
async def check_connectivity(self, *, force: bool = False) -> ConnectivityState:
"""Check the connectivity of the host."""
if force:
return await self.connected_dbus.call("check_connectivity")
else:
return await self.connected_dbus.get("connectivity")
return ConnectivityState(
await self.connected_dbus.call("check_connectivity")
)
return ConnectivityState(await self.connected_dbus.get("connectivity"))
async def connect(self, bus: MessageBus) -> None:
"""Connect to system's D-Bus."""

View File

@@ -69,7 +69,7 @@ class NetworkConnection(DBusInterfaceProxy):
@dbus_property
def state(self) -> ConnectionStateType:
"""Return the state of the connection."""
return self.properties[DBUS_ATTR_STATE]
return ConnectionStateType(self.properties[DBUS_ATTR_STATE])
@property
def state_flags(self) -> set[ConnectionStateFlags]:

View File

@@ -1,5 +1,6 @@
"""NetworkInterface object for Network Manager."""
import logging
from typing import Any
from dbus_fast.aio.message_bus import MessageBus
@@ -23,6 +24,8 @@ from .connection import NetworkConnection
from .setting import NetworkSetting
from .wireless import NetworkWireless
_LOGGER: logging.Logger = logging.getLogger(__name__)
class NetworkInterface(DBusInterfaceProxy):
"""NetworkInterface object represents Network Manager Device objects.
@@ -57,7 +60,15 @@ class NetworkInterface(DBusInterfaceProxy):
@dbus_property
def type(self) -> DeviceType:
"""Return interface type."""
return self.properties[DBUS_ATTR_DEVICE_TYPE]
try:
return DeviceType(self.properties[DBUS_ATTR_DEVICE_TYPE])
except ValueError:
_LOGGER.debug(
"Unknown device type %s for %s, treating as UNKNOWN",
self.properties[DBUS_ATTR_DEVICE_TYPE],
self.object_path,
)
return DeviceType.UNKNOWN
@property
@dbus_property

View File

@@ -5,8 +5,6 @@ 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."""
@@ -33,6 +31,4 @@ class EvaluateOperatingSystem(EvaluateBase):
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
return not self.sys_os.available

View File

@@ -184,3 +184,20 @@ async def test_interface_becomes_unmanaged(
assert wireless.is_connected is False
assert eth0.connection is None
assert connection.is_connected is False
async def test_unknown_device_type(
device_eth0_service: DeviceService, dbus_session_bus: MessageBus
):
"""Test unknown device types are handled gracefully."""
interface = NetworkInterface("/org/freedesktop/NetworkManager/Devices/1")
await interface.connect(dbus_session_bus)
# Emit an unknown device type (e.g., 1000 which doesn't exist in the enum)
device_eth0_service.emit_properties_changed({"DeviceType": 1000})
await device_eth0_service.ping()
# Should return UNKNOWN instead of crashing
assert interface.type == DeviceType.UNKNOWN
# Wireless should be None since it's not a wireless device
assert interface.wireless is None

View File

@@ -5,10 +5,7 @@ from unittest.mock import MagicMock, patch
from supervisor.const import CoreState
from supervisor.coresys import CoreSys
from supervisor.resolution.evaluations.operating_system import (
SUPPORTED_OS,
EvaluateOperatingSystem,
)
from supervisor.resolution.evaluations.operating_system import EvaluateOperatingSystem
async def test_evaluation(coresys: CoreSys):
@@ -25,13 +22,7 @@ async def test_evaluation(coresys: CoreSys):
assert operating_system.reason in coresys.resolution.unsupported
coresys.os._available = True
await operating_system()
assert operating_system.reason not in coresys.resolution.unsupported
coresys.os._available = False
coresys.host._info = MagicMock(
operating_system=SUPPORTED_OS[0], timezone=None, timezone_tzinfo=None
)
assert coresys.os.available
await operating_system()
assert operating_system.reason not in coresys.resolution.unsupported