Commit bc4b6b79 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Use decorators in admin handler.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@523 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ec6ddd6b
...@@ -28,6 +28,7 @@ from neo.protocol import Packet, UnexpectedPacketError ...@@ -28,6 +28,7 @@ from neo.protocol import Packet, UnexpectedPacketError
from neo.pt import PartitionTable from neo.pt import PartitionTable
from neo.exception import PrimaryFailure from neo.exception import PrimaryFailure
from neo.util import dump from neo.util import dump
from neo.handler import identification_required, restrict_node_types
class BaseEventHandler(EventHandler): class BaseEventHandler(EventHandler):
""" Base handler for admin node """ """ Base handler for admin node """
...@@ -215,13 +216,11 @@ class MonitoringEventHandler(BaseEventHandler): ...@@ -215,13 +216,11 @@ class MonitoringEventHandler(BaseEventHandler):
app.trying_master_node = None app.trying_master_node = None
conn.close() conn.close()
@identification_required
def handleSendPartitionTable(self, conn, packet, ptid, row_list): def handleSendPartitionTable(self, conn, packet, ptid, row_list):
logging.warning("handleSendPartitionTable") logging.warning("handleSendPartitionTable")
uuid = conn.getUUID() uuid = conn.getUUID()
if uuid is None:
raise UnexpectedPacketError
app = self.app app = self.app
nm = app.nm nm = app.nm
pt = app.pt pt = app.pt
...@@ -243,15 +242,13 @@ class MonitoringEventHandler(BaseEventHandler): ...@@ -243,15 +242,13 @@ class MonitoringEventHandler(BaseEventHandler):
pt.setCell(offset, node, state) pt.setCell(offset, node, state)
@identification_required
def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list): def handleNotifyPartitionChanges(self, conn, packet, ptid, cell_list):
logging.warning("handleNotifyPartitionChanges") logging.warning("handleNotifyPartitionChanges")
app = self.app app = self.app
nm = app.nm nm = app.nm
pt = app.pt pt = app.pt
uuid = conn.getUUID() uuid = conn.getUUID()
if uuid is None:
raise UnexpectedPacketError
node = app.nm.getNodeByUUID(uuid) node = app.nm.getNodeByUUID(uuid)
# This must be sent only by primary master node # This must be sent only by primary master node
if node.getNodeType() != MASTER_NODE_TYPE \ if node.getNodeType() != MASTER_NODE_TYPE \
...@@ -275,12 +272,10 @@ class MonitoringEventHandler(BaseEventHandler): ...@@ -275,12 +272,10 @@ class MonitoringEventHandler(BaseEventHandler):
pt.setCell(offset, node, state) pt.setCell(offset, node, state)
@identification_required
def handleNotifyNodeInformation(self, conn, packet, node_list): def handleNotifyNodeInformation(self, conn, packet, node_list):
logging.warning("handleNotifyNodeInformation") logging.warning("handleNotifyNodeInformation")
uuid = conn.getUUID() uuid = conn.getUUID()
if uuid is None:
raise UnexpectedPacketError
app = self.app app = self.app
nm = app.nm nm = app.nm
node = nm.getNodeByUUID(uuid) node = nm.getNodeByUUID(uuid)
......
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