neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
f37345
From 7931a74e691979dd23a16e7a017b4ef5bc296b79 Mon Sep 17 00:00:00 2001
f37345
From: Vojtech Trefny <vtrefny@redhat.com>
f37345
Date: Tue, 18 Oct 2022 12:28:37 +0200
f37345
Subject: [PATCH] Fix potential AttributeError when getting stratis blockdev
f37345
 info
f37345
f37345
---
f37345
 blivet/static_data/stratis_info.py | 12 +++++++-----
f37345
 1 file changed, 7 insertions(+), 5 deletions(-)
f37345
f37345
diff --git a/blivet/static_data/stratis_info.py b/blivet/static_data/stratis_info.py
f37345
index bd1c5a18..42f230ee 100644
f37345
--- a/blivet/static_data/stratis_info.py
f37345
+++ b/blivet/static_data/stratis_info.py
f37345
@@ -124,20 +124,22 @@ class StratisInfo(object):
f37345
             log.error("Failed to get DBus properties of '%s'", blockdev_path)
f37345
             return None
f37345
 
f37345
+        blockdev_uuid = str(uuid.UUID(properties["Uuid"]))
f37345
+
f37345
         pool_path = properties["Pool"]
f37345
         if pool_path == "/":
f37345
             pool_name = ""
f37345
+            return StratisBlockdevInfo(path=properties["Devnode"], uuid=blockdev_uuid,
f37345
+                                       pool_name="", pool_uuid="", object_path=blockdev_path)
f37345
         else:
f37345
             pool_info = self._get_pool_info(properties["Pool"])
f37345
             if not pool_info:
f37345
                 return None
f37345
             pool_name = pool_info.name
f37345
 
f37345
-        blockdev_uuid = str(uuid.UUID(properties["Uuid"]))
f37345
-
f37345
-        return StratisBlockdevInfo(path=properties["Devnode"], uuid=blockdev_uuid,
f37345
-                                   pool_name=pool_name, pool_uuid=pool_info.uuid,
f37345
-                                   object_path=blockdev_path)
f37345
+            return StratisBlockdevInfo(path=properties["Devnode"], uuid=blockdev_uuid,
f37345
+                                       pool_name=pool_name, pool_uuid=pool_info.uuid,
f37345
+                                       object_path=blockdev_path)
f37345
 
f37345
     def _get_locked_pools_info(self):
f37345
         locked_pools = []
f37345
-- 
f37345
2.37.3
f37345