[master 10/21] Handle sysfs size if it is missing (#1265090)

vathpela installerbot-noreply at redhat.com
Wed Oct 7 20:50:45 UTC 2015


From: "Brian C. Lane" <bcl at redhat.com>

sysfs paths may, for whatever reason, not exist. Return '0' for int()
instead of None if this is the case.

Resolves: rhbz#1265090
(cherry picked from commit 7630522c6105086ff5f09121b55de061a527e856)
---
 blivet/devices/storage.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/blivet/devices/storage.py b/blivet/devices/storage.py
index 0f595d1..f7a735f 100644
--- a/blivet/devices/storage.py
+++ b/blivet/devices/storage.py
@@ -588,7 +588,7 @@ def readCurrentSize(self):
         size = Size(0)
         if self.exists and os.path.exists(self.path) and \
            os.path.isdir(self.sysfsPath):
-            blocks = int(util.get_sysfs_attr(self.sysfsPath, "size"))
+            blocks = int(util.get_sysfs_attr(self.sysfsPath, "size") or '0')
             size = Size(blocks * LINUX_SECTOR_SIZE)
 
         return size


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


More information about the anaconda-patches mailing list