From 98eb9f62debfc33b51217a8c97b16a138314ebaa Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 10 Feb 2010 10:37:56 +0000
Subject: [PATCH] Simplify code in storage node app.run method.

Also, make logging done when catching OperationFailure exception consistent
with logging done when catching PrimaryFailure exception.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1687 71dcc9de-d417-0410-9af5-da40c76e7ee4
---
 neo/storage/app.py | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/neo/storage/app.py b/neo/storage/app.py
index ddb6c597..e5f46bb7 100644
--- a/neo/storage/app.py
+++ b/neo/storage/app.py
@@ -144,23 +144,17 @@ class Application(object):
                 # look for the primary master
                 self.connectToPrimary()
             self.operational = False
+            # check my state
+            node = self.nm.getByUUID(self.uuid)
+            if node is not None and node.isHidden():
+                self.wait()
             try:
-                while True:
-                    try:
-                        # check my state
-                        node = self.nm.getByUUID(self.uuid)
-                        if node is not None and node.isHidden():
-                            self.wait()
-                        self.verifyData()
-                        self.initialize()
-                        self.doOperation()
-                        raise RuntimeError, 'should not reach here'
-                    except OperationFailure:
-                        logging.error('operation stopped')
-                        # XXX still we can receive answer packet here
-                        # this must be handle in order not to fail
-                        self.operational = False
-
+                self.verifyData()
+                self.initialize()
+                self.doOperation()
+                raise RuntimeError, 'should not reach here'
+            except OperationFailure, msg:
+                logging.error('operation stopped: %s', msg)
             except PrimaryFailure, msg:
                 logging.error('primary master is down: %s', msg)
                 self.master_node = None
-- 
2.30.9