[master 9/15] edd: Log every glob.glob() match in our test data log.

vathpela installerbot-noreply at redhat.com
Fri Nov 6 19:20:19 UTC 2015


From: Peter Jones <pjones at redhat.com>

This way we can be sure we collect them for test cases.

Signed-off-by: Peter Jones <pjones at redhat.com>
---
 blivet/devicelibs/edd.py | 13 -------------
 blivet/util.py           |  8 +++++++-
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/blivet/devicelibs/edd.py b/blivet/devicelibs/edd.py
index b05b5d5..3a6a33c 100644
--- a/blivet/devicelibs/edd.py
+++ b/blivet/devicelibs/edd.py
@@ -358,9 +358,7 @@ def __init__(self, edd_entry, root=None):
 
     def devname_from_ata_pci_dev(self):
         pattern = util.Path('/sys/block/*', root=self.root)
-        testdata_log.debug("sysfs glob: %s", pattern)
         for path in pattern.glob():
-            testdata_log.debug("sysfs glob match: %s", path)
             emptyslash = util.Path("/", root=self.root)
             path = util.Path(path, root=self.root)
             link = util.sysfs_readlink(path=emptyslash, link=path)
@@ -426,9 +424,7 @@ def devname_from_ata_pci_dev(self):
             dev = util.join_paths(fn + ['dev%d.*' % (ata_port_idx,)])
             dev = util.Path(dev, root=self.root)
             for ataglob in [pmp, dev]:
-                testdata_log.debug("sysfs glob: %s", ataglob)
                 for atapath in ataglob.glob():
-                    testdata_log.debug("sysfs glob match: %s", atapath)
                     match = expmatcher.match(atapath.ondisk)
                     if match is None:
                         continue
@@ -469,10 +465,7 @@ def devname_from_scsi_pci_dev(self):
         }
         path = util.Path(tmpl0 % args, root=self.root)
         pattern = util.Path(tmpl1 % args, root=self.root)
-        testdata_log.debug("sysfs glob: %s", pattern)
         matching_paths = list(pattern.glob())
-        for mp in matching_paths:
-            testdata_log.debug("sysfs glob match: %s", mp)
         if os.path.isdir(path.ondisk):
             block_entries = os.listdir(path.ondisk)
             if len(block_entries) == 1:
@@ -505,11 +498,7 @@ def devname_from_scsi_pci_dev(self):
     def devname_from_virt_pci_dev(self):
         pattern = util.Path("/sys/devices/pci0000:00/0000:%s/virtio*" %
                             (self.edd.pci_dev,), root=self.root)
-        testdata_log.debug("sysfs glob: %s", pattern)
         matching_paths = tuple(pattern.glob())
-        for mp in matching_paths:
-            testdata_log.debug("sysfs glob match: %s", mp)
-
         if len(matching_paths) == 1 and os.path.exists(matching_paths[0]):
             # Normal VirtIO devices just have the block link right there...
             newpath = util.Path(matching_paths[0], root=self.root) + "/block"
@@ -571,9 +560,7 @@ def match_via_mbrsigs(self, mbr_dict):
 def collect_edd_data(root=None):
     edd_data_dict = {}
     globstr = util.Path("/sys/firmware/edd/int13_dev*/", root=root)
-    testdata_log.debug("sysfs glob: %s", globstr)
     for path in globstr.glob():
-        testdata_log.debug("sysfs glob match: %s", path)
         match = re_bios_device_number.match(path)
         biosdev = int("0x%s" % (match.group(1),), base=16)
         log.debug("edd: found device 0x%x at %s", biosdev, path)
diff --git a/blivet/util.py b/blivet/util.py
index d1d81c7..6bb13df 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -137,8 +137,14 @@ def glob(self):
             account when globbing and returns path objects with the same
             root, so you don't have to think about that part.
         """
+
+        testdata_log.debug("glob: %s", self.ondisk)
+        if "None" in self.ondisk:
+            log.error("glob: %s", self.ondisk)
+            log.error("^^ Somehow \"None\" got logged and that's never right.")
         for g in glob.glob(self.ondisk):
-            yield Path(g, root=self.root)
+            testdata_log.debug("glob match: %s", g)
+            yield Path(g, self.root)
 
     def __hash__(self):
         return self._path.__hash__()


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


More information about the anaconda-patches mailing list