[PATCH 1/4] Do not allow use of preexisting root filesystem. (#629311)

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

 



---
 pyanaconda/iw/lvm_dialog_gui.py       |   12 +++++++++---
 pyanaconda/iw/partition_dialog_gui.py |    8 +++++++-
 pyanaconda/iw/raid_dialog_gui.py      |    8 +++++++-
 pyanaconda/storage/__init__.py        |   11 +++++++++++
 4 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/pyanaconda/iw/lvm_dialog_gui.py b/pyanaconda/iw/lvm_dialog_gui.py
index cef3be8..8be27dc 100644
--- a/pyanaconda/iw/lvm_dialog_gui.py
+++ b/pyanaconda/iw/lvm_dialog_gui.py
@@ -781,9 +781,15 @@ class VolumeGroupEditor:
 
             if format.exists and format.mountable and format.mountpoint:
                 tempdev = StorageDevice('tmp', format=format)
-                if self.storage.formatByDefault(tempdev) and \
-                   not queryNoFormatPreExisting(self.intf):
-                    continue
+                if self.storage.formatByDefault(tempdev):
+                    reason = self.storage.mustFormat(tempdev)
+                    if reason:
+                        self.intf.messageWindow(_("Error"),
+                                                reason,
+                                                custom_icon="error")
+                        continue
+                    elif not queryNoFormatPreExisting(self.intf):
+                        continue
 
             # everything ok
             break
diff --git a/pyanaconda/iw/partition_dialog_gui.py b/pyanaconda/iw/partition_dialog_gui.py
index 3e4af2b..c8a72c5 100644
--- a/pyanaconda/iw/partition_dialog_gui.py
+++ b/pyanaconda/iw/partition_dialog_gui.py
@@ -374,7 +374,13 @@ class PartitionEditor:
                 if request.format.exists and \
                    getattr(request, "mountpoint", None) and \
                    self.storage.formatByDefault(request):
-                    if not queryNoFormatPreExisting(self.intf):
+                    reason = self.storage.mustFormat(request)
+                    if reason:
+                        self.intf.messageWindow(_("Error"),
+                                                reason,
+                                                custom_icon="error")
+                        continue
+                    elif not queryNoFormatPreExisting(self.intf):
                         continue
 
             # everything ok, fall out of loop
diff --git a/pyanaconda/iw/raid_dialog_gui.py b/pyanaconda/iw/raid_dialog_gui.py
index 770344c..4ed2e86 100644
--- a/pyanaconda/iw/raid_dialog_gui.py
+++ b/pyanaconda/iw/raid_dialog_gui.py
@@ -344,7 +344,13 @@ class RaidEditor:
 
                 if self.origrequest.format.exists and not format and \
                    self.storage.formatByDefault(self.origrequest):
-                    if not queryNoFormatPreExisting(self.intf):
+                    reason = self.storage.mustFormat(self.origrequest)
+                    if reason:
+                        self.intf.messageWindow(_("Error"),
+                                                reason,
+                                                custom_icon="error")
+                        continue
+                    elif not queryNoFormatPreExisting(self.intf):
 		        continue
 
                 if format:
diff --git a/pyanaconda/storage/__init__.py b/pyanaconda/storage/__init__.py
index b8b1c90..2185902 100644
--- a/pyanaconda/storage/__init__.py
+++ b/pyanaconda/storage/__init__.py
@@ -843,6 +843,17 @@ class Storage(object):
         # be safe for anything else and default to off
         return False
 
+    def mustFormat(self, device):
+        """ Return a string explaining why the device must be reformatted.
+
+            Return None if the device need not be reformatted.
+        """
+        mountpoints = ['/']
+        if device.format.mountable and device.format.mountpoint == "/":
+            return _("You must create a new filesystem on the root device.")
+
+        return None
+
     def extendedPartitionsSupported(self):
         """ Return whether any disks support extended partitions."""
         for disk in self.partitioned:
-- 
1.7.3.2

_______________________________________________
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