From 840089b8ac86ea22c1ebc1fd58f5b938c2951051 Mon Sep 17 00:00:00 2001 From: G Johansson Date: Sun, 7 Jan 2024 13:15:34 +0100 Subject: [PATCH] Handle OSError during setup for System Monitor (#107396) * Handle OSError during setup for System Monitor * Clean string copy * debug --------- Co-authored-by: Martin Hjelmare --- homeassistant/components/systemmonitor/util.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/systemmonitor/util.py b/homeassistant/components/systemmonitor/util.py index 25b8aa2eb1d6..742e0d40f3d6 100644 --- a/homeassistant/components/systemmonitor/util.py +++ b/homeassistant/components/systemmonitor/util.py @@ -25,6 +25,11 @@ def get_all_disk_mounts() -> set[str]: "No permission for running user to access %s", part.mountpoint ) continue + except OSError as err: + _LOGGER.debug( + "Mountpoint %s was excluded because of: %s", part.mountpoint, err + ) + continue if usage.total > 0 and part.device != "": disks.add(part.mountpoint) _LOGGER.debug("Adding disks: %s", ", ".join(disks))