( cls, disk_config: DiskLayoutConfiguration, disk_encryption: _DiskEncryptionSerialization, password: Password | None = None, )
| 1526 | |
| 1527 | @classmethod |
| 1528 | def parse_arg( |
| 1529 | cls, |
| 1530 | disk_config: DiskLayoutConfiguration, |
| 1531 | disk_encryption: _DiskEncryptionSerialization, |
| 1532 | password: Password | None = None, |
| 1533 | ) -> Self | None: |
| 1534 | if not cls.validate_enc(disk_config.device_modifications, disk_config.lvm_config): |
| 1535 | return None |
| 1536 | |
| 1537 | if not password: |
| 1538 | return None |
| 1539 | |
| 1540 | enc_partitions = [] |
| 1541 | for mod in disk_config.device_modifications: |
| 1542 | for part in mod.partitions: |
| 1543 | if part.obj_id in disk_encryption.get('partitions', []): |
| 1544 | enc_partitions.append(part) |
| 1545 | |
| 1546 | volumes = [] |
| 1547 | if disk_config.lvm_config: |
| 1548 | for vol in disk_config.lvm_config.get_all_volumes(): |
| 1549 | if vol.obj_id in disk_encryption.get('lvm_volumes', []): |
| 1550 | volumes.append(vol) |
| 1551 | |
| 1552 | enc = cls( |
| 1553 | EncryptionType(disk_encryption['encryption_type']), |
| 1554 | password, |
| 1555 | enc_partitions, |
| 1556 | volumes, |
| 1557 | ) |
| 1558 | |
| 1559 | if hsm := disk_encryption.get('hsm_device', None): |
| 1560 | enc.hsm_device = Fido2Device.parse_arg(hsm) |
| 1561 | |
| 1562 | if iter_time := disk_encryption.get('iter_time', None): |
| 1563 | enc.iter_time = iter_time |
| 1564 | |
| 1565 | return enc |
| 1566 | |
| 1567 | |
| 1568 | class _Fido2DeviceSerialization(TypedDict): |
nothing calls this directly
no test coverage detected