[node-patches] Change in ovirt-node[master]: New validation model should invalidate on custom plugin vali...

rbarry at redhat.com rbarry at redhat.com
Sat Oct 5 13:50:54 UTC 2013


Ryan Barry has uploaded a new change for review.

Change subject: New validation model should invalidate on custom plugin validation
......................................................................

New validation model should invalidate on custom plugin validation

With the change to validation, we weren't able to invalidate a
page and changes by throwing an exception from plugin.on_change
because plugin.__invalid_changes didn't get populated by custom
validation. Do so.

Change-Id: Ib2b1943481af377ce629593725de03c9f6d58868
Signed-off-by: Ryan Barry <rbarry at redhat.com>
---
M src/ovirt/node/plugins.py
1 file changed, 10 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/80/19880/1

diff --git a/src/ovirt/node/plugins.py b/src/ovirt/node/plugins.py
index 747e6d9..147178f 100644
--- a/src/ovirt/node/plugins.py
+++ b/src/ovirt/node/plugins.py
@@ -290,8 +290,16 @@
             # Run validators
             self.__validate(change)
 
-            # Run custom validation
-            self.on_change(change)
+            try:
+                # Run custom validation
+                self.on_change(change)
+
+            except exceptions.InvalidData as e:
+                # If caught here, it's from custom validation, and we
+                # don't know for sure what failed, so flag everything
+                self.__invalid_changes.update(dict((k, v) for (k,v) in
+                                              change.iteritems()))
+                raise e
 
             self.__changes.update(change)
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib2b1943481af377ce629593725de03c9f6d58868
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Ryan Barry <rbarry at redhat.com>



More information about the node-patches mailing list