Yedidyah Bar David has uploaded a new change for review.

Change subject: core: Alert if priorities were overriden
......................................................................

core: Alert if priorities were overriden

During buildSequence, abort if the final sequence has methods ordered
in reverse to their priorities. This might happen if the priorities
conflict with before/after.

Change-Id: I5610d172ee6dd8765beefb8b27a9a94395b232e2
Signed-off-by: Yedidyah Bar David <[email protected]>
---
M src/otopi/context.py
1 file changed, 15 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/otopi refs/changes/80/29180/1

diff --git a/src/otopi/context.py b/src/otopi/context.py
index efb4423..006a0d9 100644
--- a/src/otopi/context.py
+++ b/src/otopi/context.py
@@ -377,6 +377,21 @@
         for m in tmplist:
             sequence.setdefault(m['stage'], []).append(m)
 
+        for stage, methods in sequence.items():
+            for i,m in enumerate(methods[:-1]):
+                if m['priority'] > methods[i+1]['priority']:
+                    raise RuntimeError(
+                        _(
+                            'Priorities were reversed during buildSequence: '
+                            'method %s with priority %s appears after '
+                            'method %s with priority %s'
+                        ) % (
+                            methods[i+1]['method'],
+                            methods[i+1]['priority'],
+                            m['method'],
+                            m['priority'],
+                        )
+                    )
         self._sequence = sequence
 
     def runSequence(self):


-- 
To view, visit http://gerrit.ovirt.org/29180
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I5610d172ee6dd8765beefb8b27a9a94395b232e2
Gerrit-PatchSet: 1
Gerrit-Project: otopi
Gerrit-Branch: master
Gerrit-Owner: Yedidyah Bar David <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to