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): ...@@ -144,23 +144,17 @@ class Application(object):
# look for the primary master # look for the primary master
self.connectToPrimary() self.connectToPrimary()
self.operational = False self.operational = False
# check my state
node = self.nm.getByUUID(self.uuid)
if node is not None and node.isHidden():
self.wait()
try: try:
while True: self.verifyData()
try: self.initialize()
# check my state self.doOperation()
node = self.nm.getByUUID(self.uuid) raise RuntimeError, 'should not reach here'
if node is not None and node.isHidden(): except OperationFailure, msg:
self.wait() logging.error('operation stopped: %s', msg)
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
except PrimaryFailure, msg: except PrimaryFailure, msg:
logging.error('primary master is down: %s', msg) logging.error('primary master is down: %s', msg)
self.master_node = None 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