Commit bdf12b24 authored by Vincent Pelletier's avatar Vincent Pelletier

Make UUID readable in assertion error message.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1580 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f9a9442b
...@@ -21,6 +21,7 @@ from neo import protocol ...@@ -21,6 +21,7 @@ from neo import protocol
from neo.protocol import NodeTypes, NodeStates, Packets from neo.protocol import NodeTypes, NodeStates, Packets
from neo.master.handlers import MasterHandler from neo.master.handlers import MasterHandler
from neo.exception import ElectionFailure from neo.exception import ElectionFailure
from neo.util import dump
class ElectionHandler(MasterHandler): class ElectionHandler(MasterHandler):
"""This class deals with events for a primary master election.""" """This class deals with events for a primary master election."""
...@@ -86,7 +87,7 @@ class ClientElectionHandler(ElectionHandler): ...@@ -86,7 +87,7 @@ class ClientElectionHandler(ElectionHandler):
def connectionFailed(self, conn): def connectionFailed(self, conn):
addr = conn.getAddress() addr = conn.getAddress()
node = self.app.nm.getByAddress(addr) node = self.app.nm.getByAddress(addr)
assert node.isUnknown(), (self.app.uuid, node.whoSetState(), assert node.isUnknown(), (dump(self.app.uuid), node.whoSetState(),
node.getState()) node.getState())
# connection never success, node is still in unknown state # connection never success, node is still in unknown state
self.app.negotiating_master_node_set.discard(addr) self.app.negotiating_master_node_set.discard(addr)
...@@ -104,7 +105,7 @@ class ClientElectionHandler(ElectionHandler): ...@@ -104,7 +105,7 @@ class ClientElectionHandler(ElectionHandler):
def _connectionLost(self, conn): def _connectionLost(self, conn):
addr = conn.getAddress() addr = conn.getAddress()
node = self.app.nm.getByAddress(addr) node = self.app.nm.getByAddress(addr)
assert not node.isUnknown(), (self.app.uuid, node.whoSetState(), assert not node.isUnknown(), (dump(self.app.uuid), node.whoSetState(),
node.getState()) node.getState())
node.setTemporarilyDown() node.setTemporarilyDown()
self.app.negotiating_master_node_set.discard(addr) self.app.negotiating_master_node_set.discard(addr)
......
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