[blivet] Never pass None to devicePathToName (#996303)

David Shea dshea at redhat.com
Tue Mar 11 20:53:14 UTC 2014


Provide a string default to getattr so that logging doesn't crash if
there an error looking up partitions.
---
 blivet/devices.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blivet/devices.py b/blivet/devices.py
index fb24b10..c2d1869 100644
--- a/blivet/devices.py
+++ b/blivet/devices.py
@@ -1341,14 +1341,14 @@ class PartitionDevice(StorageDevice):
             # getPartitionBySector doesn't work on extended partitions
             _partition = _disklabel.extendedPartition
             log.debug("extended lookup found partition %s"
-                        % devicePathToName(getattr(_partition, "path", None)))
+                        % devicePathToName(getattr(_partition, "path", "(none)")))
         else:
             # lookup the partition by sector to avoid the renumbering
             # nonsense entirely
             _sector = self.partedPartition.geometry.start
             _partition = _disklabel.partedDisk.getPartitionBySector(_sector)
             log.debug("sector-based lookup found partition %s"
-                        % devicePathToName(getattr(_partition, "path", None)))
+                        % devicePathToName(getattr(_partition, "path", "(none)")))
 
         self.partedPartition = _partition
 
-- 
1.8.5.3



More information about the anaconda-patches mailing list