[rhel7/blivet] prevent traceback when root device is not defined #rhbz883768

Samantha N. Bueno sbueno+anaconda at redhat.com
Tue Feb 19 18:36:46 UTC 2013


On Tue, Feb 12, 2013 at 02:16:05PM -0800, Brian C. Lane wrote:
> The goal of sanityCheck is to gather up all the errors and return them
> as one block instead of returning after some of them. You could add a
> root check right before the checks there are failing and that will keep
> it from raising an exception.

New patch below:

---
 blivet/__init__.py | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/blivet/__init__.py b/blivet/__init__.py
index 9dc7f23..1532523 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -1408,16 +1408,16 @@ class Blivet(object):
         except (DeviceError, AttributeError):
             boot = None
 
-        if not root:
+        if root:
+            if root.size < 250:
+                warnings.append(_("Your root partition is less than 250 "
+                                  "megabytes which is usually too small to "
+                                  "install %s.") % (productName,))
+        else:
             errors.append(_("You have not defined a root partition (/), "
                             "which is required for installation of %s "
                             "to continue.") % (productName,))
 
-        if root and root.size < 250:
-            warnings.append(_("Your root partition is less than 250 "
-                              "megabytes which is usually too small to "
-                              "install %s.") % (productName,))
-
         # Prevent users from installing on s390x with (a) no /boot volume, (b) the
         # root volume on LVM, and (c) the root volume not restricted to a single
         # PV
@@ -1425,13 +1425,12 @@ class Blivet(object):
         # restricted to a single PV.  The backend support is there, but there are
         # no UI hook-ups to drive that functionality, but I do not personally
         # care.  --dcantrell
-        if arch.isS390() and \
-           not self.mountpoints.has_key('/boot') and \
-           root.type == 'lvmlv' and not root.singlePV:
-            errors.append(_("This platform requires /boot on a dedicated "
-                            "partition or logical volume.  If you do not "
-                            "want a /boot volume, you must place / on a "
-                            "dedicated non-LVM partition."))
+        if arch.isS390() and not self.mountpoints.has_key('/boot') and root:
+            if root.type == 'lvmlv' and not root.singlePV:
+                errors.append(_("This platform requires /boot on a dedicated "
+                                "partition or logical volume.  If you do not "
+                                "want a /boot volume, you must place / on a "
+                                "dedicated non-LVM partition."))
 
         # FIXME: put a check here for enough space on the filesystems. maybe?
 
-- 
1.7.11.7


More information about the anaconda-patches mailing list