[PATCH 6/8] Make teardownAll work regardless of flags.
David Lehman
dlehman at redhat.com
Thu Feb 20 18:01:38 UTC 2014
Instead of making it do nothing except in installer mode, just don't call
it when it doesn't make sense to do so.
---
blivet/__init__.py | 3 +++
blivet/devicetree.py | 9 +++++----
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/blivet/__init__.py b/blivet/__init__.py
index 63d63bc..cc5014d 100644
--- a/blivet/__init__.py
+++ b/blivet/__init__.py
@@ -380,6 +380,9 @@ class Blivet(object):
def shutdown(self):
""" Deactivate all devices (installer_mode only). """
+ if not flags.installer_mode:
+ return
+
try:
self.devicetree.teardownAll()
except Exception as e:
diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 69d65f8..7b17205 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -264,6 +264,9 @@ class DeviceTree(object):
try:
action.execute()
except DiskLabelCommitError:
+ if not flags.installer_mode:
+ raise
+
# it's likely that a previous format destroy action
# triggered setup of an lvm or md device.
self.teardownAll()
@@ -2100,7 +2103,8 @@ class DeviceTree(object):
# inconsistencies are ignored or resolved.
self._handleInconsistencies()
- self.teardownAll()
+ if flags.installer_mode:
+ self.teardownAll()
def _is_ignored(disk):
return ((self.ignoredDisks and disk.name in self.ignoredDisks) or
@@ -2123,9 +2127,6 @@ class DeviceTree(object):
def teardownAll(self):
""" Run teardown methods on all devices. """
- if not flags.installer_mode:
- return
-
for device in self.leaves:
if device.protected:
continue
--
1.8.5.3
More information about the anaconda-patches
mailing list