[PATCH] Add a property to Platform for accessing boot stage1 constraints.

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

 



---
 pyanaconda/bootloader.py |   29 ++++++++++++-----------------
 pyanaconda/platform.py   |   12 ++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/pyanaconda/bootloader.py b/pyanaconda/bootloader.py
index 4c495d2..039cd59 100644
--- a/pyanaconda/bootloader.py
+++ b/pyanaconda/bootloader.py
@@ -412,7 +412,7 @@ class BootLoader(object):
 
     @property
     def device_descriptions(self):
-        return self.platform._boot_descriptions
+        return self.platform.bootStage1ConstraintDict["descriptions"]
 
     #
     # constraint checking for target devices
@@ -581,13 +581,7 @@ class BootLoader(object):
             return False
 
         description = self.device_description(device)
-        device_types = self.platform._boot_stage1_device_types
-        format_types = self.platform._boot_stage1_format_types
-        mountpoints = self.platform._boot_stage1_mountpoints
-        raid_levels = self.platform._boot_stage1_raid_levels
-        raid_member_types = self.platform._boot_stage1_raid_member_types
-        raid_metadata = self.platform._boot_stage1_raid_metadata
-        max_end_mb = self.platform._boot_stage1_max_end_mb
+        constraint = self.platform.bootStage1ConstraintDict
 
         if self.stage2_is_valid_stage1 and device == self.stage2_device:
             # special case
@@ -598,7 +592,7 @@ class BootLoader(object):
             self.warnings = []
             return valid
 
-        if not self._device_type_match(device, device_types):
+        if not self._device_type_match(device, constraint["device_types"]):
             self.errors.append(_("The %s cannot be of type %s")
                                % (description, device.type))
             valid = False
@@ -612,14 +606,15 @@ class BootLoader(object):
             valid = False
 
         if not self._is_valid_location(device,
-                                       max_mb=max_end_mb,
+                                       max_mb=constraint["max_end_mb"],
                                        desc=description):
             valid = False
 
-        if not self._is_valid_md(device, device_types=device_types,
-                                 raid_levels=raid_levels,
-                                 metadata=raid_metadata,
-                                 member_types=raid_member_types,
+        if not self._is_valid_md(device,
+                                 device_types=constraint["device_types"],
+                                 raid_levels=constraint["raid_levels"],
+                                 metadata=constraint["raid_metadata"],
+                                 member_types=constraint["raid_member_types"],
                                  desc=description):
             valid = False
 
@@ -632,8 +627,8 @@ class BootLoader(object):
             valid = False
 
         if not self._is_valid_format(device,
-                                     format_types=format_types,
-                                     mountpoints=mountpoints,
+                                     format_types=constraint["format_types"],
+                                     mountpoints=constraint["mountpoints"],
                                      desc=description):
             valid = False
 
@@ -654,7 +649,7 @@ class BootLoader(object):
             of all valid target devices, sorted by device type, then sorted
             according to our drive ordering.
         """
-        device_types = self.platform._boot_stage1_device_types
+        device_types = self.platform.bootStage1ConstraintDict["device_types"]
         slots = [[] for t in device_types]
         for device in self.storage.devices:
             idx = self._device_type_index(device, device_types)
diff --git a/pyanaconda/platform.py b/pyanaconda/platform.py
index 93cd2f8..893a3c3 100644
--- a/pyanaconda/platform.py
+++ b/pyanaconda/platform.py
@@ -75,6 +75,18 @@ class Platform(object):
         """The default disklabel type for this architecture."""
         return self.diskLabelTypes[0]
 
+    @property
+    def bootStage1ConstraintDict(self):
+        d = {"device_types": self._boot_stage1_device_types,
+             "format_types": self._boot_stage1_format_types,
+             "mountpoints": self._boot_stage1_mountpoints,
+             "max_end_mb": self._boot_stage1_max_end_mb,
+             "raid_levels": self._boot_stage1_raid_levels,
+             "raid_metadata": self._boot_stage1_raid_metadata,
+             "raid_member_types": self._boot_stage1_raid_member_types,
+             "descriptions": self._boot_descriptions}
+        return d
+
     def requiredDiskLabelType(self, device_type):
         return None
 
-- 
1.7.3.4

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux