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