neil / rpms / python-blivet

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