← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:lp-1925722-v2 into curtin:master

 

Dan Bungert has proposed merging ~dbungert/curtin:lp-1925722-v2 into curtin:master.

Commit message:
Fix for grub_device based detection of target

* grub_device means we mean to image THAT device, so we shouldn't keep
  the entire list of devices as plausible image targets.
    
(Thanks to Ryan Harper and Lee Trager for good discussions and fix
 proposals)


Requested reviews:
  Ryan Harper (raharper)

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/401825
-- 
Your team curtin developers is subscribed to branch curtin:master.
diff --git a/curtin/commands/block_meta.py b/curtin/commands/block_meta.py
index c027cbf..52342ff 100644
--- a/curtin/commands/block_meta.py
+++ b/curtin/commands/block_meta.py
@@ -1989,10 +1989,13 @@ def meta_simple(args):
             serial = i.get("serial")
             if serial is None:
                 continue
-            grub = i.get("grub_device")
-            diskPath = block.lookup_disk(serial)
-            if grub is True:
+            try:
+                diskPath = block.lookup_disk(serial)
+            except ValueError:
+                continue
+            if i.get("grub_device"):
                 devpath = diskPath
+                break
 
     devices = args.devices
     bootpt = get_bootpt_cfg(
@@ -2030,10 +2033,10 @@ def meta_simple(args):
                 LOG.warn("No non-removable, installable devices found. List "
                          "populated with removable devices allowed: %s",
                          devices)
-    elif len(devices) == 0 and devpath:
-        devices = [devpath]
 
-    if len(devices) > 1:
+    if devpath is not None:
+        target = devpath
+    elif len(devices) > 1:
         if args.devices is not None:
             LOG.warn("'%s' mode but multiple devices given. "
                      "using first found", args.mode)

Follow ups