Fixes additional encryption prompt even tho partitions was marked for encryption (#1264)

Corrected the check for partitions marked with `encrypt: true`
This commit is contained in:
Anton Hvornum 2022-05-28 10:06:22 +02:00 committed by GitHub
parent 78449f75bc
commit 5c9bd235d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -433,7 +433,8 @@ def disk_layouts() -> Optional[Dict[str, Any]]:
def encrypted_partitions(blockdevices :Dict[str, Any]) -> bool: def encrypted_partitions(blockdevices :Dict[str, Any]) -> bool:
for partition in blockdevices.values(): for blockdevice in blockdevices.values():
for partition in blockdevice.get('partitions', []):
if partition.get('encrypted', False): if partition.get('encrypted', False):
yield partition yield partition

View File

@ -204,6 +204,7 @@ class GlobalMenu(GeneralMenu):
# Then we need to identify which partitions to encrypt. This will default to / (root). # Then we need to identify which partitions to encrypt. This will default to / (root).
if len(list(encrypted_partitions(storage['arguments'].get('disk_layouts', [])))) == 0: if len(list(encrypted_partitions(storage['arguments'].get('disk_layouts', [])))) == 0:
for blockdevice in storage['arguments']['disk_layouts']: for blockdevice in storage['arguments']['disk_layouts']:
if storage['arguments']['disk_layouts'][blockdevice].get('partitions'):
for partition_index in select_encrypted_partitions( for partition_index in select_encrypted_partitions(
title="Select which partitions to encrypt:", title="Select which partitions to encrypt:",
partitions=storage['arguments']['disk_layouts'][blockdevice]['partitions'] partitions=storage['arguments']['disk_layouts'][blockdevice]['partitions']

View File

@ -374,8 +374,6 @@ def select_encrypted_partitions(
if len(partition_indexes) == 0: if len(partition_indexes) == 0:
return None return None
title = _('Select which partitions to mark for formatting:')
# show current partition layout: # show current partition layout:
if len(partitions): if len(partitions):
title += current_partition_layout(partitions) + '\n' title += current_partition_layout(partitions) + '\n'