Re: [PATCH] Make the disk model an attribute of DiskDevice.

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

 



Looks good.

On 04/02/2009 04:44 PM, David Lehman wrote:
---
  iw/autopart_type.py            |    2 +-
  iw/partition_ui_helpers_gui.py |    3 +--
  storage/devices.py             |    4 ++++
  textw/partition_text.py        |    2 +-
  4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/iw/autopart_type.py b/iw/autopart_type.py
index 18b5cca..1b35573 100644
--- a/iw/autopart_type.py
+++ b/iw/autopart_type.py
@@ -413,7 +413,7 @@ class PartitionTypeWindow(InstallWindow):
          for disk in self.storage.disks:
              if disk.name not in self.anaconda.id.bootloader.drivelist:
                  continue
-            dispstr = "%s %8.0f MB %s" %(disk.name, disk.size, disk.partedDisk.device.model)
+            dispstr = "%s %8.0f MB %s" %(disk.name, disk.size, disk.model)
              i = bootstore.append(None)
              bootstore[i] = (dispstr, disk.name)
              if disk.name == defaultBoot:
diff --git a/iw/partition_ui_helpers_gui.py b/iw/partition_ui_helpers_gui.py
index 0ad1803..af5bd6a 100644
--- a/iw/partition_ui_helpers_gui.py
+++ b/iw/partition_ui_helpers_gui.py
@@ -151,10 +151,9 @@ def createAllowedDrivesStore(disks, reqdrives, drivelist, selectDrives=True,
                      selected = 1

          sizestr = "%8.0f MB" % disk.size
-        # TODO: abstract disk model so we don't have to reach into parted.Disk
          drivelist.append_row((disk.name,
                                sizestr,
-                              disk.partedDisk.device.model),
+                              disk.model),
                               selected)

      if len(disks)<  2:
diff --git a/storage/devices.py b/storage/devices.py
index 32e4c23..32ee2c7 100644
--- a/storage/devices.py
+++ b/storage/devices.py
@@ -712,6 +712,10 @@ class DiskDevice(StorageDevice):
          return self.partedDevice is not None

      @property
+    def model(self):
+        return getattr(self.partedDevice, "model", None)
+
+    @property
      def size(self):
          """ The disk's size in MB """
          if not self.mediaPresent:
diff --git a/textw/partition_text.py b/textw/partition_text.py
index 472a5ce..8b71754 100644
--- a/textw/partition_text.py
+++ b/textw/partition_text.py
@@ -95,7 +95,7 @@ class PartitionTypeWindow:
              cleardrives = anaconda.id.storage.clearPartDisks

              for disk in disks:
-                model = disk.partedDisk.device.model
+                model = disk.model

                  if not cleardrives or len(cleardrives)<  1:
                      selected = 1


--
David Cantrell <dcantrell@xxxxxxxxxx>
Red Hat / Honolulu, HI

_______________________________________________
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