Allowing individual partitions safety checks to rely on the parent blockdevice keep_partitions status.

This commit is contained in:
Anton Hvornum 2021-03-29 16:59:09 +02:00
parent 5e9c973d42
commit f3907310e3
No known key found for this signature in database
GPG Key ID: F1234C5BA67C59DF
1 changed files with 3 additions and 0 deletions

View File

@ -237,6 +237,9 @@ class Partition():
return True if files > 0 else False
def safe_to_format(self):
if self.block_device and self.block_device.keep_partitions is True:
return True
if self.allow_formatting is False:
log(f"Partition {self} is not marked for formatting.", level=LOG_LEVELS.Debug)
return False