Marking newly created partitions as safe to format in use_entire_disk(), by adding allow_formatting=True to the partitions. Also added some debugging to help aiding in support cases.

This commit is contained in:
Anton Hvornum 2021-03-21 13:00:37 +01:00
parent 886c60f9bc
commit 75d1395b10
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 5 additions and 0 deletions

View File

@ -217,8 +217,10 @@ class Partition():
def safe_to_format(self):
if self.allow_formatting is False:
log(f"Partition {self} is not marked for formatting.", level=LOG_LEVELS.Debug)
return False
elif self.target_mountpoint == '/boot' and self.has_content():
log(f"Partition {self} is a boot partition and has content inside.", level=LOG_LEVELS.Debug)
return False
return True
@ -424,6 +426,9 @@ class Filesystem():
self.blockdevice.partition[0].target_mountpoint = '/boot'
self.blockdevice.partition[1].target_mountpoint = '/'
self.blockdevice.partition[0].allow_formatting = True
self.blockdevice.partition[1].allow_formatting = True
if encrypt_root_partition:
log(f"Marking partition {self.blockdevice.partition[1]} as encrypted.", level=LOG_LEVELS.Debug)
self.blockdevice.partition[1].encrypted = True