neil / rpms / python-blivet

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