Avoid crash if lsblk output can't be read

This commit is contained in:
Mathieu Comandon 2024-01-08 01:19:50 -08:00
parent 73863761e0
commit 238b20da83

View file

@ -164,6 +164,8 @@ class LinuxSystem: # pylint: disable=too-many-public-methods
def get_drives():
"""Return a list of drives with their filesystems"""
lsblk_output = system.read_process_output(["lsblk", "-f", "--json"])
if not lsblk_output:
return []
return [
drive
for drive in json.loads(lsblk_output)["blockdevices"]