Skip to content

Commit 87fc84c

Browse files
authored
Avoid setup failure on missing timedatectl (home-assistant#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.
1 parent e38ca5a commit 87fc84c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

supervisor/host/control.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,13 @@ async def set_datetime(self, new_time: datetime) -> None:
8585

8686
async def set_timezone(self, timezone: str) -> None:
8787
"""Set timezone on host."""
88-
self._check_dbus(HostFeature.TIMEDATE)
89-
9088
# /etc/localtime is not writable on OS older than 16.2
9189
if (
9290
self.coresys.os.available
9391
and self.coresys.os.version is not None
9492
and self.sys_os.version >= AwesomeVersion("16.2.dev20250814")
9593
):
94+
self._check_dbus(HostFeature.TIMEDATE)
9695
_LOGGER.info("Setting host timezone: %s", timezone)
9796
await self.sys_dbus.timedate.set_timezone(timezone)
9897
await self.sys_dbus.timedate.update()

0 commit comments

Comments
 (0)