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

vathpela installerbot-noreply at redhat.com
Fri Nov 6 18:31:23 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 ec4999c..3fdbe65 100644
--- a/blivet/devicelibs/edd.py
+++ b/blivet/devicelibs/edd.py
@@ -357,9 +357,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)
@@ -425,9 +423,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
@@ -468,10 +464,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:
@@ -504,11 +497,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"
@@ -570,9 +559,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 58756aa..e55c680 100644
--- a/blivet/util.py
+++ b/blivet/util.py
@@ -135,8 +135,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/ebe57d7a331a9ca221e1c6d717a489f7b77cf6ad


More information about the anaconda-patches mailing list