Commit 3739fbae authored by Grégory Wisniewski's avatar Grégory Wisniewski

Reduce indentation.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1588 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6302acca
......@@ -707,28 +707,29 @@ class Application(object):
# wait for all transaction to be finished
while True:
self.em.poll(1)
if not self.tm.hasPending():
if self.cluster_state == ClusterStates.RUNNING:
sys.exit("Application has been asked to shut down")
else:
# no more transaction, ask clients to shutdown
logging.info("asking all clients to shutdown")
for c in self.em.getConnectionList():
node = self.nm.getByUUID(c.getUUID())
if node.isClient():
node_list = [(node.getType(), node.getAddress(),
node.getUUID(), NodeStates.DOWN)]
c.notify(Packets.NotifyNodeInformation(node_list))
# then ask storages and master nodes to shutdown
logging.info("asking all remaining nodes to shutdown")
for c in self.em.getConnectionList():
node = self.nm.getByUUID(c.getUUID())
if node.isStorage() or node.isMaster():
node_list = [(node.getType(), node.getAddress(),
node.getUUID(), NodeStates.DOWN)]
c.notify(Packets.NotifyNodeInformation(node_list))
# then shutdown
sys.exit("Cluster has been asked to shut down")
if self.tm.hasPending():
continue
if self.cluster_state == ClusterStates.RUNNING:
sys.exit("Application has been asked to shut down")
else:
# no more transaction, ask clients to shutdown
logging.info("asking all clients to shutdown")
for c in self.em.getConnectionList():
node = self.nm.getByUUID(c.getUUID())
if node.isClient():
node_list = [(node.getType(), node.getAddress(),
node.getUUID(), NodeStates.DOWN)]
c.notify(Packets.NotifyNodeInformation(node_list))
# then ask storages and master nodes to shutdown
logging.info("asking all remaining nodes to shutdown")
for c in self.em.getConnectionList():
node = self.nm.getByUUID(c.getUUID())
if node.isStorage() or node.isMaster():
node_list = [(node.getType(), node.getAddress(),
node.getUUID(), NodeStates.DOWN)]
c.notify(Packets.NotifyNodeInformation(node_list))
# then shutdown
sys.exit("Cluster has been asked to shut down")
def identifyStorageNode(self, uuid, node):
state = NodeStates.RUNNING
......
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