diff --git a/archinstall/__init__.py b/archinstall/__init__.py index 5757405e5..aec47685c 100644 --- a/archinstall/__init__.py +++ b/archinstall/__init__.py @@ -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', '') ) diff --git a/archinstall/lib/disk/device_model.py b/archinstall/lib/disk/device_model.py index 78847ce71..75321d5b1 100644 --- a/archinstall/lib/disk/device_model.py +++ b/archinstall/lib/disk/device_model.py @@ -1232,32 +1232,35 @@ def validate_enc(cls, disk_config: DiskLayoutConfiguration) -> bool: 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