Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/archinstall/lib/disk/device_model.py
diff options
context:
space:
mode:
authorDaniel Girtler <blackrabbit256@gmail.com>2023-06-28 21:34:54 +1000
committerGitHub <noreply@github.com>2023-06-28 13:34:54 +0200
commit57ebc42ffd64babb121c940caa3c5ff415062162 (patch)
tree94102eb75d226a2537fcdcedf42a1914092f883c /archinstall/lib/disk/device_model.py
parent82a53207647bca3d8aa797619b22b0a2dd68897b (diff)
Fix 1875 (#1880)
Co-authored-by: Daniel Girtler <girtler.daniel@gmail.com>
Diffstat (limited to 'archinstall/lib/disk/device_model.py')
-rw-r--r--archinstall/lib/disk/device_model.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py
index 35fbd40c..97623772 100644
--- a/archinstall/lib/disk/device_model.py
+++ b/archinstall/lib/disk/device_model.py
@@ -283,7 +283,7 @@ class _PartitionInfo:
partition: Partition
name: str
type: PartitionType
- fs_type: FilesystemType
+ fs_type: Optional[FilesystemType]
path: Path
start: Size
length: Size
@@ -313,7 +313,7 @@ class _PartitionInfo:
def from_partition(
cls,
partition: Partition,
- fs_type: FilesystemType,
+ fs_type: Optional[FilesystemType],
partuuid: str,
mountpoints: List[Path],
btrfs_subvol_infos: List[_BtrfsSubvolumeInfo] = []
@@ -594,7 +594,7 @@ class PartitionModification:
type: PartitionType
start: Size
length: Size
- fs_type: FilesystemType
+ fs_type: Optional[FilesystemType]
mountpoint: Optional[Path] = None
mount_options: List[str] = field(default_factory=list)
flags: List[PartitionFlag] = field(default_factory=list)
@@ -613,6 +613,9 @@ class PartitionModification:
if self.is_exists_or_modify() and not self.dev_path:
raise ValueError('If partition marked as existing a path must be set')
+ if self.fs_type is None and self.status == ModificationStatus.Modify:
+ raise ValueError('FS type must not be empty on modifications with status type modify')
+
def __hash__(self):
return hash(self._obj_id)
@@ -628,6 +631,12 @@ class PartitionModification:
raise ValueError('Device path was not set')
return self.dev_path
+ @property
+ def safe_fs_type(self) -> FilesystemType:
+ if self.fs_type is None:
+ raise ValueError('File system type is not set')
+ return self.fs_type
+
@classmethod
def from_existing_partition(cls, partition_info: _PartitionInfo) -> PartitionModification:
if partition_info.btrfs_subvol_infos:
@@ -714,7 +723,7 @@ class PartitionModification:
'type': self.type.value,
'start': self.start.__dump__(),
'length': self.length.__dump__(),
- 'fs_type': self.fs_type.value,
+ 'fs_type': self.fs_type.value if self.fs_type else '',
'mountpoint': str(self.mountpoint) if self.mountpoint else None,
'mount_options': self.mount_options,
'flags': [f.name for f in self.flags],
@@ -731,7 +740,7 @@ class PartitionModification:
'Type': self.type.value,
'Start': self.start.format_size(Unit.MiB),
'Length': self.length.format_size(Unit.MiB),
- 'FS type': self.fs_type.value,
+ 'FS type': self.fs_type.value if self.fs_type else 'Unknown',
'Mountpoint': self.mountpoint if self.mountpoint else '',
'Mount options': ', '.join(self.mount_options),
'Flags': ', '.join([f.name for f in self.flags]),