Commit 97089f72 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use getConnectionlistByUUID instead of the deprecated getConnectionByUUID.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@1741 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent cca7e029
...@@ -148,8 +148,9 @@ class PrimaryNotificationsHandler(BaseHandler): ...@@ -148,8 +148,9 @@ class PrimaryNotificationsHandler(BaseHandler):
for node_type, addr, uuid, state in node_list: for node_type, addr, uuid, state in node_list:
if state != NodeStates.RUNNING: if state != NodeStates.RUNNING:
# close connection to this node if no longer running # close connection to this node if no longer running
conn = self.app.em.getConnectionByUUID(uuid) conn_list = self.app.em.getConnectionListByUUID(uuid)
if conn is not None: if conn_list:
conn = conn_list[0]
conn.close() conn.close()
if node_type == NodeTypes.STORAGE: if node_type == NodeTypes.STORAGE:
# Remove from pool connection # Remove from pool connection
......
...@@ -186,7 +186,8 @@ class MasterNotificationsHandlerTests(MasterHandlerTests): ...@@ -186,7 +186,8 @@ class MasterNotificationsHandlerTests(MasterHandlerTests):
(NodeTypes.STORAGE, addr, self.getNewUUID(), NodeStates.DOWN), (NodeTypes.STORAGE, addr, self.getNewUUID(), NodeStates.DOWN),
] ]
conn1, conn2 = Mock({'__repr__': 'conn1'}), Mock({'__repr__': 'conn2'}) conn1, conn2 = Mock({'__repr__': 'conn1'}), Mock({'__repr__': 'conn2'})
self.app.em = Mock({'getConnectionByUUID': ReturnValues(conn1, conn2)}) self.app.em = Mock({'getConnectionListByUUID': ReturnValues([conn1],
[conn2])})
self.app.cp = Mock() self.app.cp = Mock()
self.handler.notifyNodeInformation(conn, node_list) self.handler.notifyNodeInformation(conn, node_list)
# node manager updated # node manager updated
......
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