[1/2 blivet] Add early keyword to setUpBootLoader (#1086811)

Brian C. Lane bcl at redhat.com
Tue Jun 24 23:09:05 UTC 2014


Anaconda custom partitioning needs to call setUpBootLoader but at that
point the stage1_device setup would fail, so add a flag to skip it so
that stage1_drive gets setup without an error being raised.
---
 blivet/__init__.py | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 455b681..f28c32a 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1804,10 +1804,16 @@ class Blivet(object):
         boot_disks.sort(cmp=self.compareDisks, key=lambda d: d.name)
         self.bootloader.set_disk_list(boot_disks)
 
-    def setUpBootLoader(self):
+    def setUpBootLoader(self, early=False):
         """ Propagate ksdata into BootLoader.
 
+            :keyword bool  early: Set to True to skip stage1_device setup
+
             :raises BootloaderError: if stage1 setup fails
+
+            If this needs to be run early, eg. to setup stage1_disk but
+            not stage1_device 'early' should be set True to prevent
+            it from raising BootloaderError
         """
         if not self.bootloader or not self.ksdata:
             log.warning("either ksdata or bootloader data missing")
@@ -1821,7 +1827,8 @@ class Blivet(object):
         self.ksdata.bootloader.execute(self, self.ksdata, None)
         self.bootloader.stage1_disk = self.devicetree.resolveDevice(self.ksdata.bootloader.bootDrive)
         self.bootloader.stage2_device = self.bootDevice
-        self.bootloader.set_stage1_device(self.devices)
+        if not early:
+            self.bootloader.set_stage1_device(self.devices)
 
     @property
     def bootDisk(self):
-- 
1.9.3



More information about the anaconda-patches mailing list