mirror of
https://github.com/home-assistant/core.git
synced 2025-07-15 17:27:10 +00:00
Handle no permission for disks in Systemmonitor (#106653)
This commit is contained in:
parent
4cd1965786
commit
853e4d87fa
@ -18,7 +18,13 @@ def get_all_disk_mounts() -> set[str]:
|
|||||||
# ENOENT, pop-up a Windows GUI error for a non-ready
|
# ENOENT, pop-up a Windows GUI error for a non-ready
|
||||||
# partition or just hang.
|
# partition or just hang.
|
||||||
continue
|
continue
|
||||||
usage = psutil.disk_usage(part.mountpoint)
|
try:
|
||||||
|
usage = psutil.disk_usage(part.mountpoint)
|
||||||
|
except PermissionError:
|
||||||
|
_LOGGER.debug(
|
||||||
|
"No permission for running user to access %s", part.mountpoint
|
||||||
|
)
|
||||||
|
continue
|
||||||
if usage.total > 0 and part.device != "":
|
if usage.total > 0 and part.device != "":
|
||||||
disks.add(part.mountpoint)
|
disks.add(part.mountpoint)
|
||||||
_LOGGER.debug("Adding disks: %s", ", ".join(disks))
|
_LOGGER.debug("Adding disks: %s", ", ".join(disks))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user