Ignore disk encryption config when no password found (#2779)
This commit is contained in:
parent
0370e893ac
commit
83ece36ec3
|
|
@ -255,11 +255,10 @@ def load_config() -> None:
|
|||
arguments['audio_config'] = models.AudioConfiguration.parse_arg(arguments['audio_config'])
|
||||
|
||||
if arguments.get('disk_encryption', None) is not None and disk_config is not None:
|
||||
password = arguments.get('encryption_password', '')
|
||||
arguments['disk_encryption'] = disk.DiskEncryption.parse_arg(
|
||||
arguments['disk_config'],
|
||||
arguments['disk_encryption'],
|
||||
password
|
||||
arguments.get('encryption_password', '')
|
||||
)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1232,32 +1232,35 @@ class DiskEncryption:
|
|||
def parse_arg(
|
||||
cls,
|
||||
disk_config: DiskLayoutConfiguration,
|
||||
arg: Dict[str, Any],
|
||||
disk_encryption: Dict[str, Any],
|
||||
password: str = ''
|
||||
) -> Optional['DiskEncryption']:
|
||||
if not cls.validate_enc(disk_config):
|
||||
return None
|
||||
|
||||
if len(password) < 1:
|
||||
return None
|
||||
|
||||
enc_partitions = []
|
||||
for mod in disk_config.device_modifications:
|
||||
for part in mod.partitions:
|
||||
if part.obj_id in arg.get('partitions', []):
|
||||
if part.obj_id in disk_encryption.get('partitions', []):
|
||||
enc_partitions.append(part)
|
||||
|
||||
volumes = []
|
||||
if disk_config.lvm_config:
|
||||
for vol in disk_config.lvm_config.get_all_volumes():
|
||||
if vol.obj_id in arg.get('lvm_volumes', []):
|
||||
if vol.obj_id in disk_encryption.get('lvm_volumes', []):
|
||||
volumes.append(vol)
|
||||
|
||||
enc = DiskEncryption(
|
||||
EncryptionType(arg['encryption_type']),
|
||||
EncryptionType(disk_encryption['encryption_type']),
|
||||
password,
|
||||
enc_partitions,
|
||||
volumes
|
||||
)
|
||||
|
||||
if hsm := arg.get('hsm_device', None):
|
||||
if hsm := disk_encryption.get('hsm_device', None):
|
||||
enc.hsm_device = Fido2Device.parse_arg(hsm)
|
||||
|
||||
return enc
|
||||
|
|
|
|||
Loading…
Reference in New Issue