[PATCH] Don't apply action until after all checks have passed.

David Lehman dlehman at redhat.com
Thu Apr 24 16:07:43 UTC 2014


---
 blivet/devicetree.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/blivet/devicetree.py b/blivet/devicetree.py
index 731c448..1fe7d4b 100644
--- a/blivet/devicetree.py
+++ b/blivet/devicetree.py
@@ -438,8 +438,6 @@ class DeviceTree(object):
             if action.device in self._devices:
                 raise DeviceTreeError("device is already in the tree")
 
-        action.apply()
-
         if action.isCreate and action.isDevice:
             self._addDevice(action.device)
         elif action.isDestroy and action.isDevice:
@@ -449,6 +447,8 @@ class DeviceTree(object):
                action.device.format.mountpoint in self.filesystems:
                 raise DeviceTreeError("mountpoint already in use")
 
+        # apply the action before adding it in case apply raises an exception
+        action.apply()
         log.info("registered action: %s", action)
         self._actions.append(action)
 
-- 
1.9.0



More information about the anaconda-patches mailing list