tools/osbuild-mpp: set part ID from name if missing

For our Fedora CoreOS disk images we set the partition labels (name)
for the partitions. This is also supported using the primitives here
in OSBuild, but it wasn't obvious that I needed to set the name in
the mpp-define-images definition. Let's set the name there, but let's
also allow osbuild-mpp to set the `id`, which is what is used later
to access that partition from the `name` too if `id` isn't set.

This means we allow something like:

   - name: BIOS-BOOT
     type: 21686148-6449-6E6F-744E-656564454649
     bootable: true
     uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
     size: 100

rather than requiring something like:

   - id: BIOS-BOOT
     name: BIOS-BOOT
     type: 21686148-6449-6E6F-744E-656564454649
     bootable: true
     uuid: FAC7F1FB-3E8D-4137-A512-961DE09A5549
     size: 100
This commit is contained in:
Dusty Mabe 2023-11-27 15:53:13 -05:00 committed by Simon de Vlieger
parent 5ad3f968e1
commit e191dc1d0d
3 changed files with 19 additions and 9 deletions

View file

@ -283,6 +283,7 @@ Example:
"partitions": [
{
"id": "bios-boot",
"name": "BIOS-BOOT",
"start": 2048,
"size": 2048,
"type": "21686148-6449-6E6F-744E-656564454649",
@ -820,7 +821,8 @@ class Partition:
name: str = None,
uuid: str = None,
attrs: List[int] = None):
self.id = uid
# if no id provided, use the part-label (name) as the id
self.id = uid or name
self.type = pttype
self.start = start
self.size = size