[master 1/5] edd: Make devicetree not use edd.edd_dict, instead use blivet's copy.

vathpela installerbot-noreply at redhat.com
Tue Oct 13 21:11:38 UTC 2015


From: Peter Jones <pjones at redhat.com>

The edd module used to try to cache the edd output at the module level.
This makes tests awkward when they replace the whole dataset without
trying to fix the whole module scope, so I had removed it, not realizing
blivet.devicetree.resolveDevice() was using it.

This makes blivet.devicetree.resolveDevice() use blivet.eddDict instead.

This fixes the following error from http://newcutlet.install.bos.redhat.com:8080/job/blivet-master-PR/105/console :

E1101(no-member):938,42: DeviceTree.resolveDevice: Module 'blivet.devicelibs.edd' has no 'edd_dict' member

Signed-off-by: Peter Jones <pjones at redhat.com>
---
 blivet/blivet.py     | 1 +
 blivet/devicetree.py | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/blivet/blivet.py b/blivet/blivet.py
index 4df8cf6..f713c7c 100644
--- a/blivet/blivet.py
+++ b/blivet/blivet.py
@@ -279,6 +279,7 @@ def reset(self, cleanupOnly=False):
         self.devicetree.populate(cleanupOnly=cleanupOnly)
         self.fsset = FSSet(self.devicetree)
         self.eddDict = get_edd_dict(self.partitioned)
+        self.devicetree.eddDict = self.eddDict
         if self.bootloader:
             # clear out bootloader attributes that refer to devices that are
             # no longer in the tree
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 274fc0d..ce40136 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -35,7 +35,6 @@
 from .devices import LVMLogicalVolumeDevice, LVMVolumeGroupDevice
 from . import formats, arch
 from .devicelibs import lvm
-from .devicelibs import edd
 from . import udev
 from . import util
 from .util import open  # pylint: disable=redefined-builtin
@@ -102,6 +101,8 @@ def reset(self, conf=None, passphrase=None, luksDict=None,
 
         lvm.lvm_cc_resetFilter()
 
+        self.eddDict = {}
+
         self._populator = Populator(self,
                                     conf=conf,
                                     passphrase=passphrase,
@@ -935,7 +936,7 @@ def resolveDevice(self, devspec, blkidTab=None, cryptTab=None, options=None):
         elif re.match(r'(0x)?[A-Za-z0-9]{2}(p\d+)?$', devspec):
             # BIOS drive number
             spec = int(devspec, 16)
-            for (edd_name, edd_number) in edd.edd_dict.items():
+            for (edd_name, edd_number) in self.eddDict.items():
                 if edd_number == spec:
                     device = self.getDeviceByName(edd_name)
                     break


-- 
To view this commit on github, visit https://github.com/rhinstaller/blivet/commit/a9b3ccc1af5586ba000269bfe51918f4119d2728


More information about the anaconda-patches mailing list