Ryan Barry has uploaded a new change for review. Change subject: Allow nested transactions ......................................................................
Allow nested transactions Allow Transactions to be nested as transaction elements. Implementation didn't require the consumer pattern, as the code was already structured to allow with minimal changes. Change-Id: Ia74e1dff22827f0b5fb47ba57eaa72c304998474 Signed-off-by: Ryan Barry <[email protected]> --- M src/ovirt/node/utils/__init__.py 1 file changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/93/19493/1 diff --git a/src/ovirt/node/utils/__init__.py b/src/ovirt/node/utils/__init__.py index 22cabdd..035260f 100644 --- a/src/ovirt/node/utils/__init__.py +++ b/src/ovirt/node/utils/__init__.py @@ -203,11 +203,15 @@ self._prepared_elements = [] for element in self: self.logger.debug("Preparing element '%s'" % element) - if Transaction.Element not in element.__class__.mro(): + if Transaction in element.__class__.mro(): + for idx, tx_element in element.step(): + self._prepared_elements.append(tx_element) + elif Transaction.Element not in element.__class__.mro(): raise exceptions.PreconditionError(("%s is no Transaction." + "Element") % element) - self._prepared_elements.append(element) - element.prepare() + else: + self._prepared_elements.append(element) + element.prepare() return True def commit(self): -- To view, visit http://gerrit.ovirt.org/19493 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia74e1dff22827f0b5fb47ba57eaa72c304998474 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-node Gerrit-Branch: master Gerrit-Owner: Ryan Barry <[email protected]> _______________________________________________ node-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/node-patches
