[rhel5-branch][PATCH] Just log warning if cannot show it (#767260)

Vratislav Podzimek vpodzime at redhat.com
Mon May 20 11:48:19 UTC 2013


If the anaconda instance is not passed to the DiskSet and it thus have no
interface available to show a warning with, just log the warning and continue
instead of raising an expcetion.

Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
---
 partedUtils.py | 37 +++++++++++++++++++++----------------
 1 file changed, 21 insertions(+), 16 deletions(-)

diff --git a/partedUtils.py b/partedUtils.py
index be66426..1d81803 100644
--- a/partedUtils.py
+++ b/partedUtils.py
@@ -1330,22 +1330,27 @@ class DiskSet:
 
             # check for more than 15 partitions (libata limit)
             if drive.startswith('sd') and disk.get_last_partition_num() > 15:
-                rc = intf.messageWindow(_("Warning"),
-                                       _("The drive /dev/%s has more than 15 "
-                                         "partitions on it.  The SCSI "
-                                         "subsystem in the Linux kernel does "
-                                         "not allow for more than 15 partitons "
-                                         "at this time.  You will not be able "
-                                         "to make changes to the partitioning "
-                                         "of this disk or use any partitions "
-                                         "beyond /dev/%s15 in %s")
-                                        % (drive, drive, productName),
-                                        type="custom",
-                                        custom_buttons = [_("_Reboot"),
-                                                          _("_Continue")],
-                                        custom_icon="warning")
-                if rc == 0:
-                    sys.exit(0)
+                msg = _("The drive /dev/%s has more than 15 "
+                        "partitions on it.  The SCSI "
+                        "subsystem in the Linux kernel does "
+                        "not allow for more than 15 partitons "
+                        "at this time.  You will not be able "
+                        "to make changes to the partitioning "
+                        "of this disk or use any partitions "
+                        "beyond /dev/%s15 in %s") % (drive, drive, productName)
+
+                if intf:
+                    rc = intf.messageWindow(_("Warning"), msg,
+                                            type="custom",
+                                            custom_buttons = [_("_Reboot"),
+                                                              _("_Continue")],
+                                            custom_icon="warning")
+                    if rc == 0:
+                        sys.exit(0)
+                else:
+                    # no interface instance to show warning with, just log it
+                    # and continue
+                    log.warning(msg)
 
             # check that their partition table is valid for their architecture
             ret = checkDiskLabel(disk, intf)
-- 
1.7.11.7



More information about the anaconda-patches mailing list