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

[PATCH 08/13] Allow unsetting of stage1_device.



Also handle trying to set a default stage1 device when there are no
valid candidate devices.
---
 pyanaconda/bootloader.py |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 791b1fc..79659a5 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -275,18 +275,25 @@ class BootLoader(object):
     def stage1_device(self):
         """ Stage1 target device. """
         if not self._stage1_device:
-            self.stage1_device = self.stage1_devices[0]
+            log.debug("no stage1 device: %s" % self.stage1_devices)
+            try:
+                self.stage1_device = self.stage1_devices[0]
+            except IndexError:
+                pass
 
         return self._stage1_device
 
     @stage1_device.setter
     def stage1_device(self, device):
-        if not self._is_valid_stage1_device(device):
+        if device and not self._is_valid_stage1_device(device):
             raise ValueError("%s is not a valid stage1 device" % device.name)
 
-        log.debug("new bootloader stage1 device: %s" % device.name)
+        log.debug("new bootloader stage1 device: %s" % getattr(device,
+                                                               "name", None))
         self._stage1_device = device
-        self.stage1_drive = device.disks[0]
+        if device:
+            self.stage1_drive = device.disks[0]
+
 
     @property
     def stage2_device(self):
-- 
1.7.3.4


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