36 lines
1.6 KiB
Diff
36 lines
1.6 KiB
Diff
From 083c30a02f9335965fc1b27984e39f6fe443c590 Mon Sep 17 00:00:00 2001
|
|
From: Vojtech Trefny <vtrefny@redhat.com>
|
|
Date: Tue, 21 Sep 2021 12:44:26 +0200
|
|
Subject: [PATCH] Fix DeviceFormatError when removing a non-existing MD array
|
|
|
|
We can't run format.teardown() for formats that have not been
|
|
created yet.
|
|
|
|
Resolves: rhbz#2005289
|
|
---
|
|
blivetgui/blivet_utils.py | 11 ++++++-----
|
|
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/blivetgui/blivet_utils.py b/blivetgui/blivet_utils.py
|
|
index 6fe99a7..e7d23da 100644
|
|
--- a/blivetgui/blivet_utils.py
|
|
+++ b/blivetgui/blivet_utils.py
|
|
@@ -598,11 +598,12 @@ def delete_device(self, blivet_device, delete_parents):
|
|
# the mdmember format from the parents
|
|
if blivet_device.type == "mdarray":
|
|
for parent in blivet_device.parents:
|
|
- try:
|
|
- parent.format.teardown()
|
|
- except Exception as e: # pylint: disable=broad-except
|
|
- return ProxyDataContainer(success=False, actions=None, message=None, exception=e,
|
|
- traceback=traceback.format_exc())
|
|
+ if parent.format.exists:
|
|
+ try:
|
|
+ parent.format.teardown()
|
|
+ except Exception as e: # pylint: disable=broad-except
|
|
+ return ProxyDataContainer(success=False, actions=None, message=None, exception=e,
|
|
+ traceback=traceback.format_exc())
|
|
result = self._delete_format(parent)
|
|
if not result.success:
|
|
return result
|