@@ -0,0 +1,749 @@
+# encoding: utf-8%0A%0Afrom oslo_utils import excutils%0A%0A%0Aclass UndoManager(object):%0A    %22%22%22Provides a mechanism to facilitate rolling back a series of actions%0A    when an exception is raised.%0A    %22%22%22%0A    def __init__(self):%0A        self.undo_stack = %5B%5D%0A%0A    def undo_with(self, undo_func):%0A        self.undo_stack.append(undo_func)%0A%0A    def _rollback(self):%0A        for undo_func in reversed(self.undo_stack):%0A            undo_func()%0A%0A    def rollback_and_reraise(self, msg=None, **kwargs):%0A        %22%22%22Rollback a series of actions then re-raise the exception.%0A%0A        .. note:: (sirp) This should only be called within an%0A                  exception handler.%0A        %22%22%22%0A        with excutils.save_and_reraise_exception():%0A            self._rollback()%0A

Add the undo manager.