Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnton Hvornum <anton@hvornum.se>2021-02-07 18:50:30 +0100
committerAnton Hvornum <anton@hvornum.se>2021-02-07 18:50:30 +0100
commit9038fda9911f40ede813c5492f34b68411db65b8 (patch)
tree63ff9d05aa2038bc3615fcd4ede338bd051ada4f
parent9db589f10a1ba5e96f2343c25cba8fff32e0332c (diff)
Added error handling for get_mount_info()
-rw-r--r--archinstall/lib/disk.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/archinstall/lib/disk.py b/archinstall/lib/disk.py
index 6c7e63ba..80e9c740 100644
--- a/archinstall/lib/disk.py
+++ b/archinstall/lib/disk.py
@@ -127,15 +127,17 @@ class Partition():
if mountpoint:
self.mount(mountpoint)
- partition_info = get_partition_info(self.path)
+ mount_information = get_mount_info(self.path)
- if self.mountpoint != partition_info['target'] and mountpoint:
- raise DiskError(f"{self} was given a mountpoint but the actual mountpoint differs: {partition_info['target']}")
- if partition_info['fstype'] != self.filesystem and filesystem:
- raise DiskError(f"{self} was given a filesystem format, but a existing format was detected: {partition_info['fstype']}")
+ if self.mountpoint != mount_information['target'] and mountpoint:
+ raise DiskError(f"{self} was given a mountpoint but the actual mountpoint differs: {mount_information['target']}")
+ if mount_information['fstype'] != self.filesystem and filesystem:
+ raise DiskError(f"{self} was given a filesystem format, but a existing format was detected: {mount_information['fstype']}")
- self.mountpoint = partition_info['target']
- self.filesystem = partition_info['fstype']
+ if (target := mount_information.get('target', None)):
+ self.mountpoint = target
+ if (fstype := mount_information.get('fstype', None)):
+ self.filesystem = fstype
def __repr__(self, *args, **kwargs):
if self.encrypted:
@@ -344,8 +346,12 @@ def harddrive(size=None, model=None, fuzzy=False):
return collection[drive]
-def get_partition_info(path):
- output = b''.join(sys_command(f'/usr/bin/findmnt --json {path}'))
+def get_mount_info(path):
+ try:
+ output = b''.join(sys_command(f'/usr/bin/findmnt --json {path}'))
+ except SysCallError:
+ return {}
+
output = output.decode('UTF-8')
output = json.loads(output)
if 'filesystems' in output: