← Back to team overview

curtin-dev team mailing list archive

[Merge] ~raharper/curtin:fix/uefi-mount-check-fails-no-path into curtin:master

 

Ryan Harper has proposed merging ~raharper/curtin:fix/uefi-mount-check-fails-no-path into curtin:master.

Commit message:
curthooks: uefi_find_grub_device_ids handle type:mount without path

When scanning a curtin storage config for efi mount entries we failed
to handle the case where an entry does not contain the 'path' key.
Curtin storage config type:mount does not require a 'path' element.
Change to using .get('path') when looking for efi mount path.

LP: #1892242

Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #1892242 in curtin: "Curtin doesn't handle swap partitions properly"
  https://bugs.launchpad.net/curtin/+bug/1892242

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/389571
-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:fix/uefi-mount-check-fails-no-path into curtin:master.
diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
index 458eb9d..51f11d6 100644
--- a/curtin/commands/curthooks.py
+++ b/curtin/commands/curthooks.py
@@ -557,7 +557,7 @@ def uefi_find_grub_device_ids(sconfig):
                 esp_partitions.append(item_id)
                 continue
 
-        if item['type'] == 'mount' and item['path'] == '/boot/efi':
+        if item['type'] == 'mount' and item.get('path') == '/boot/efi':
             if primary_esp:
                 LOG.debug('Ignoring duplicate mounted primary ESP: %s',
                           item_id)
diff --git a/tests/unittests/test_curthooks.py b/tests/unittests/test_curthooks.py
index e45362c..a6ae86e 100644
--- a/tests/unittests/test_curthooks.py
+++ b/tests/unittests/test_curthooks.py
@@ -1725,6 +1725,12 @@ class TestUefiFindGrubDeviceIds(CiTestCase):
                         'fstype': 'fat32',
                     },
                     {
+                        'id': 'vdb-part2-swap_mount',
+                        'type': 'mount',
+                        'device': 'vdb-part2-swap_format',
+                        'options': '',
+                    },
+                    {
                         'id': 'vdb-part1_mount',
                         'type': 'mount',
                         'device': 'vdb-part1_format',

Follow ups