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

[PATCH 5/6] Remove devices property from FSSet, use the one from Storage.



The devices property in Storage and FSSet were the same.  Remove the one
from FSSet and have that class reference the one from Storage.
---
 booty/ppc.py        |    4 ++--
 storage/__init__.py |   17 +++++++----------
 upgrade.py          |    2 +-
 yuminstall.py       |    2 +-
 4 files changed, 11 insertions(+), 14 deletions(-)

diff --git a/booty/ppc.py b/booty/ppc.py
index 9e43090..42aae57 100644
--- a/booty/ppc.py
+++ b/booty/ppc.py
@@ -14,11 +14,11 @@ class ppcBootloaderInfo(bootloaderInfo):
         machine = iutil.getPPCMachine()
 
         if machine == 'pSeries':
-            for dev in self.storage.fsset.devices:
+            for dev in self.storage.devices:
                 if dev.format.type == "prepboot":
                     retval.append(dev.path)
         elif machine == 'PMac':
-            for dev in self.storage.fsset.devices:
+            for dev in self.storage.devices:
                 if dev.format.type == "hfs" and dev.format.bootable:
                     retval.append(dev.path)
 
diff --git a/storage/__init__.py b/storage/__init__.py
index 494bef0..10fe07a 100644
--- a/storage/__init__.py
+++ b/storage/__init__.py
@@ -224,7 +224,8 @@ class Storage(object):
                                      passphrase=self.encryptionPassphrase,
                                      luksDict=self.__luksDevs,
                                      iscsi=self.iscsi)
-        self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
+        self.fsset = FSSet(self.devicetree, self.anaconda.rootPath,
+                           self.devices)
 
     def doIt(self):
         self.devicetree.processActions()
@@ -291,7 +292,8 @@ class Storage(object):
                                      luksDict=self.__luksDevs,
                                      iscsi=self.iscsi)
         self.devicetree.populate()
-        self.fsset = FSSet(self.devicetree, self.anaconda.rootPath)
+        self.fsset = FSSet(self.devicetree, self.anaconda.rootPath,
+                           self.devices)
         self.anaconda.id.rootParts = None
         self.anaconda.id.upgradeRoot = None
         w.pop()
@@ -299,9 +301,7 @@ class Storage(object):
     @property
     def devices(self):
         """ A list of all the devices in the device tree. """
-        devices = self.devicetree.devices
-        devices.sort(key=lambda d: d.path)
-        return devices
+        return sorted(self.devicetree.devices, key=lambda d: d.path)
 
     @property
     def disks(self):
@@ -1306,9 +1306,10 @@ def get_containing_device(path, devicetree):
 
 class FSSet(object):
     """ A class to represent a set of filesystems. """
-    def __init__(self, devicetree, rootpath):
+    def __init__(self, devicetree, rootpath, devices):
         self.devicetree = devicetree
         self.rootpath = rootpath
+        self.devices = devices
         self.cryptTab = None
         self.blkidTab = None
         self.origFStab = None
@@ -1364,10 +1365,6 @@ class FSSet(object):
         return self._devshm
 
     @property
-    def devices(self):
-        return sorted(self.devicetree.devices, key=lambda d: d.path)
-
-    @property
     def mountpoints(self):
         filesystems = {}
         for device in self.devices:
diff --git a/upgrade.py b/upgrade.py
index c751533..1ae9a58 100644
--- a/upgrade.py
+++ b/upgrade.py
@@ -146,7 +146,7 @@ def upgradeSwapSuggestion(anaconda):
 
     fsList = []
 
-    for device in anaconda.id.storage.fsset.devices:
+    for device in anaconda.id.storage.devices:
         if not device.format:
             continue
         if device.format.mountable and device.format.linuxNative:
diff --git a/yuminstall.py b/yuminstall.py
index b247b52..4e13939 100644
--- a/yuminstall.py
+++ b/yuminstall.py
@@ -1295,7 +1295,7 @@ reposdir=/etc/anaconda.repos.d,/tmp/updates/anaconda.repos.d,/tmp/product/anacon
             selectKernel("kernel")
 
     def selectFSPackages(self, storage):
-        for device in storage.fsset.devices:
+        for device in storage.devices:
             # this takes care of device and filesystem packages
             map(self.selectPackage, device.packages)
 
-- 
1.6.2.5


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