mirror of
https://github.com/home-assistant/supervisor.git
synced 2026-05-08 17:08:36 +01:00
Avoid setup failure on missing timedatectl (#6169)
When timedatectl is not available (e.g. in minimal devcontainers), the code currently fails to setup due to missing timedate service on D-Bus. This change makes the code more robust by checking only checking for the presence of the service if we actually going to use it.
This commit is contained in:
@@ -85,14 +85,13 @@ class SystemControl(CoreSysAttributes):
|
||||
|
||||
async def set_timezone(self, timezone: str) -> None:
|
||||
"""Set timezone on host."""
|
||||
self._check_dbus(HostFeature.TIMEDATE)
|
||||
|
||||
# /etc/localtime is not writable on OS older than 16.2
|
||||
if (
|
||||
self.coresys.os.available
|
||||
and self.coresys.os.version is not None
|
||||
and self.sys_os.version >= AwesomeVersion("16.2.dev20250814")
|
||||
):
|
||||
self._check_dbus(HostFeature.TIMEDATE)
|
||||
_LOGGER.info("Setting host timezone: %s", timezone)
|
||||
await self.sys_dbus.timedate.set_timezone(timezone)
|
||||
await self.sys_dbus.timedate.update()
|
||||
|
||||
Reference in New Issue
Block a user