[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH 1/3] Return the first qualifying device from opticalInstallMedia.



We claim to return a list, but since we never unmount after
finding valid media, we can never return a list of more than
a single device.
---
 pyanaconda/image.py                |    9 +++++----
 pyanaconda/ui/gui/spokes/source.py |    3 ++-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/image.py b/pyanaconda/image.py
index 01e01cd..7bfdb52 100644
--- a/pyanaconda/image.py
+++ b/pyanaconda/image.py
@@ -176,10 +176,10 @@ def mountImage(isodir, tree, messageWindow):
         else:
             break
 
-# Return a list of Device instances containing valid optical install media
+# Return the first Device instance containing valid optical install media
 # for this product.
-def opticalInstallMedia(devicetree, mountpoint="/tmp/mnt"):
-    retval = []
+def opticalInstallMedia(devicetree, mountpoint=INSTALL_TREE):
+    retval = None
 
     for dev in devicetree.getDevicesByType("cdrom"):
         devicetree.updateDeviceFormat(dev)
@@ -192,7 +192,8 @@ def opticalInstallMedia(devicetree, mountpoint="/tmp/mnt"):
             dev.format.unmount()
             continue
 
-        retval.append(dev)
+        retval = dev
+        break
 
     return retval
 
diff --git a/pyanaconda/ui/gui/spokes/source.py b/pyanaconda/ui/gui/spokes/source.py
index b5e88c8..cfe5fec 100644
--- a/pyanaconda/ui/gui/spokes/source.py
+++ b/pyanaconda/ui/gui/spokes/source.py
@@ -284,7 +284,8 @@ class SourceSpoke(NormalSpoke):
         # If we found any optical install media, display a selector for each
         # of those.
         added = False
-        for cdrom in opticalInstallMedia(self.devicetree, mountpoint=MOUNTPOINT):
+        cdrom = opticalInstallMedia(self.devicetree, mountpoint=MOUNTPOINT)
+        if cdrom
             selector = AnacondaWidgets.DiskOverview(cdrom.format.label or "", "drive-removable-media", "")
             selector.path = cdrom.path
             self._autodetectMediaBox.pack_start(selector, False, False, 0)
-- 
1.7.9.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]