Re: [PATCH 1/3] Implement the save to USB using devicetree devices.

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

 



What if part does not have a format? Not sure if this
can happen, but better safe then sorry.

Regards,

Hans


On 04/15/2009 03:57 PM, Joel Granados Moreno wrote:
---
  storage/__init__.py |   29 +++++++++++++----------------
  1 files changed, 13 insertions(+), 16 deletions(-)

diff --git a/storage/__init__.py b/storage/__init__.py
index 8678b6e..5deb6ee 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -456,25 +456,22 @@ class Storage(object):
          self.reset()

          dests = []
-        for device in self.devices:
-            if not device.removable:
-                continue

-            try:
-                dev = parted.Device(path=device.path)
-                disk = parted.Disk(device=dev)
-            except Exception:
-                continue
+        for part in self.disks:
+            if not disk.removable and \
+                    disk.format is not None  and \
+                    disk.format.mountable:
+                dests.append([disk.path, disk.name])

-            for part in disk.partitions:
-                if part.active and \
-                   not part.getFlag(parted.PARTITION_RAID) and \
-                   not part.getFlag(parted.PARTITION_LVM) and \
-                   part.fileSystem.type in ("ext3", "ext2", "fat16", "fat32"):
-                    dests.append([part.path, device.name])
+        for part in self.partitions:
+            if not part.disk.removable:
+                continue

-            if not disk.partitions:
-                dests.append([device.path, device.name])
+            elif part.partedPartition.active and \
+                    not part.partedPartition.getFlag(parted.PARTITION_RAID) and \
+                    not part.partedPartition.getFlag(parted.PARTITION_LVM) and \
+                    part.format.mountable:
+                dests.append([part.path, part.name])

          return dests


_______________________________________________
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