Re: [PATCH 3/3] Update code that checks for devices that contain install media.

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

 



Also looks ok,

Regards,

Hans


On 07/01/2009 01:13 AM, David Lehman wrote:
---
  iw/partition_dialog_gui.py |    2 +-
  storage/__init__.py        |    9 ++++-----
  storage/devicetree.py      |    4 ++--
  storage/partitioning.py    |    7 +++----
  yuminstall.py              |    9 +++------
  5 files changed, 13 insertions(+), 18 deletions(-)

diff --git a/iw/partition_dialog_gui.py b/iw/partition_dialog_gui.py
index 8e0161e..d38aa4e 100644
--- a/iw/partition_dialog_gui.py
+++ b/iw/partition_dialog_gui.py
@@ -429,7 +429,7 @@ class PartitionEditor:
          # aren't protected (we'd still like to be able to mount them, though)
  	self.fsoptionsDict = {}
          if self.origrequest.exists and \
-           not self.storage.isProtected(self.origrequest):
+           not self.origrequest.protected:
  	    (row, self.fsoptionsDict) = createPreExistFSOptionSection(self.origrequest, maintable, row, self.mountCombo, self.storage, luksdev=luksdev)

          # size options
diff --git a/storage/__init__.py b/storage/__init__.py
index c88f310..74970c1 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -501,7 +501,7 @@ class Storage(object):
          if not isinstance(device, Device):
              raise ValueError("arg1 (%s) must be a Device instance" % device)

-        if not ignoreProtected and device.name in self.protectedPartitions:
+        if not ignoreProtected and device.protected:
              return _("This partition is holding the data for the hard "
                        "drive install.")
          elif isinstance(device, PartitionDevice) and device.isProtected:
@@ -895,7 +895,7 @@ class Storage(object):

      def isProtected(self, device):
          """ Return True is the device is protected. """
-        return device.name in self.protectedPartitions
+        return device.protected

      def checkNoDisks(self):
          """Check that there are valid disk devices."""
@@ -1015,7 +1015,7 @@ def findExistingRootDevices(anaconda, upgradeany=False):
          if not device.format.linuxNative or not device.format.mountable:
              continue

-        if device.name in anaconda.id.storage.protectedPartitions:
+        if device.protected:
              # can't upgrade the part holding hd: media so why look at it?
              continue

@@ -1057,8 +1057,7 @@ def mountExistingSystem(anaconda, rootEnt,
      else:
          readOnly = ""

-    if rootDevice.name in anaconda.id.storage.protectedPartitions and \
-       os.path.ismount("/mnt/isodir"):
+    if rootDevice.protected and os.path.ismount("/mnt/isodir"):
          isys.mount("/mnt/isodir",
                     rootPath,
                     fstype=rootDevice.format.type,
diff --git a/storage/devicetree.py b/storage/devicetree.py
index 23504c6..3c613c7 100644
--- a/storage/devicetree.py
+++ b/storage/devicetree.py
@@ -1607,8 +1607,8 @@ class DeviceTree(object):
              device.format = None
              return

-        if shouldClear(device, self.clearPartType, self.clearPartDisks,
-                       self.protectedPartitions):
+        if shouldClear(device, self.clearPartType,
+                       clearPartDisks=self.clearPartDisks):
              # if this is a partition that will be cleared by clearpart,
              # don't bother with format-specific processing
              return
diff --git a/storage/partitioning.py b/storage/partitioning.py
index 5071ee0..7c6b1a7 100644
--- a/storage/partitioning.py
+++ b/storage/partitioning.py
@@ -258,7 +258,7 @@ def doAutoPartition(anaconda):
          anaconda.id.storage.reset()
          return DISPATCH_BACK

-def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=None):
+def shouldClear(part, clearPartType, clearPartDisks=None):
      if not isinstance(part, PartitionDevice):
          return False

@@ -277,7 +277,7 @@ def shouldClear(part, clearPartType, clearPartDisks=None, protectedPartitions=No
          return False

      # Don't clear partitions holding install media.
-    if protectedPartitions and part.name in protectedPartitions:
+    if part.protected:
          return False

      # We don't want to fool with extended partitions, freespace,&c
@@ -321,8 +321,7 @@ def clearPartitions(storage):
      clearparts = [] # list of partitions we'll remove
      for part in partitions:
          log.debug("clearpart: looking at %s" % part.name)
-        if not shouldClear(part, storage.clearPartType, storage.clearPartDisks,
-                           storage.protectedPartitions):
+        if not shouldClear(part, storage.clearPartType, storage.clearPartDisks):
              continue

          log.debug("clearing %s" % part.name)
diff --git a/yuminstall.py b/yuminstall.py
index 6be1baa..8972f1d 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1434,12 +1434,9 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon

          # If there are any protected partitions we want to mount, create their
          # mount points now.
-        protected = anaconda.id.storage.protectedPartitions
-        if protected:
-            for protectedDev in protected:
-                request = anaconda.id.storage.devicetree.getDeviceByName(protectedDev)
-                if request and request.format.mountpoint:
-                    dirList.append(request.format.mountpoint)
+        for protected in anaconda.id.storage.protectedDevices:
+            if getattr(protected.format, "mountpoint", None):
+                dirList.append(protected.format.mountpoint)

          for i in dirList:
              try:

_______________________________________________
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