[Neo-report] r2137 gregory - /trunk/neo/storage/handlers/identification.py

nobody at svn.erp5.org nobody at svn.erp5.org
Mon Jun 7 14:33:59 CEST 2010


Author: gregory
Date: Mon Jun  7 14:33:59 2010
New Revision: 2137

Log:
Check broken state before any possible change.

This check was always false in the case of a client.
Move the 'node is None' condition in the potential scope.

Modified:
    trunk/neo/storage/handlers/identification.py

Modified: trunk/neo/storage/handlers/identification.py
==============================================================================
--- trunk/neo/storage/handlers/identification.py [iso-8859-1] (original)
+++ trunk/neo/storage/handlers/identification.py [iso-8859-1] Mon Jun  7 14:33:59 2010
@@ -36,6 +36,9 @@
             raise protocol.NotReadyError
         app = self.app
         node = app.nm.getByUUID(uuid)
+        # If this node is broken, reject it.
+        if node is not None and node.isBroken():
+            raise protocol.BrokenNodeDisallowedError
         # choose the handler according to the node type
         if node_type == NodeTypes.CLIENT:
             from neo.storage.handlers.client import ClientOperationHandler
@@ -46,14 +49,11 @@
         elif node_type == NodeTypes.STORAGE:
             from neo.storage.handlers.storage import StorageOperationHandler
             handler = StorageOperationHandler
+            if node is None:
+                logging.error('reject an unknown storage node %s', dump(uuid))
+                raise protocol.NotReadyError
         else:
             raise protocol.ProtocolError('reject non-client-or-storage node')
-        if node is None:
-            logging.error('reject an unknown node %s', dump(uuid))
-            raise protocol.NotReadyError
-        # If this node is broken, reject it.
-        if node.isBroken():
-            raise protocol.BrokenNodeDisallowedError
         # apply the handler and set up the connection
         handler = handler(self.app)
         conn.setHandler(handler)





More information about the Neo-report mailing list