Commit 98eb9f62 authored by Vincent Pelletier's avatar Vincent Pelletier

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
parent c1c5e475
......@@ -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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment