[PATCH 1/5] Turn protected devices into a property on the Anaconda object.

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

 



This is needed so I can avoid duplicating the logic of what is and is not
a protected device in the filtering UI.
---
 anaconda            |   13 +++++++++++++
 storage/__init__.py |   13 +++----------
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/anaconda b/anaconda
index f613618..051466f 100755
--- a/anaconda
+++ b/anaconda
@@ -549,6 +549,19 @@ class Anaconda(object):
         return self._platform
 
     @property
+    def protected(self):
+        import stat
+
+        if os.path.exists("/dev/live") and \
+           stat.S_ISBLK(os.stat("/dev/live")[stat.ST_MODE]):
+            return [os.readlink("/dev/live")]
+        elif self.methodstr and self.methodstr.startswith("hd:"):
+            method = self.methodstr[3:]
+            return [method.split(":", 3)[0]]
+        else:
+            return []
+
+    @property
     def users(self):
         if not self._users:
             import users
diff --git a/storage/__init__.py b/storage/__init__.py
index 4e3bbf7..52ff543 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -85,18 +85,11 @@ def storageInitialize(anaconda):
     anaconda.intf.resetReinitInconsistentLVMQuestion()
 
     # Set up the protected partitions list now.
-    if os.path.exists("/dev/live") and \
-       stat.S_ISBLK(os.stat("/dev/live")[stat.ST_MODE]):
-        target = os.readlink("/dev/live")
-        storage.protectedDevSpecs = [target]
-        storage.reset()
-    elif anaconda.methodstr and anaconda.methodstr.startswith("hd:"):
-        method = anaconda.methodstr[3:]
-        devspec = method.split(":", 3)[0]
-        storage.protectedDevSpecs.append(devspec)
+    if anaconda.protected:
+        storage.protectedDevSpecs.extend(anaconda.protected)
         storage.reset()
 
-        if not storage.protectedDevices:
+        if not flags.livecdInstall and not storage.protectedDevices:
             if anaconda.upgrade:
                 return
             else:
-- 
1.6.5.1

_______________________________________________
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