merge from HEAD
[plcapi.git] / PLC / Methods / DeleteNode.py
index c8dc2d8..d0bf3a5 100644 (file)
@@ -24,16 +24,18 @@ class DeleteNode(Method):
 
     returns = Parameter(int, '1 if successful')
 
+    object_type = 'Node'
+
 
     def call(self, auth, node_id_or_hostname):
         # Get account information
         nodes = Nodes(self.api, [node_id_or_hostname])
         if not nodes:
             raise PLCInvalidArgument, "No such node"
-
         node = nodes[0]
-       ### xxx here xxx
-       PLCCheckLocalNode(node,"DeleteNode")
+
+        if node['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local node"
 
         # If we are not an admin, make sure that the caller is a
         # member of the site at which the node is located.
@@ -45,6 +47,9 @@ class DeleteNode(Method):
                 raise PLCPermissionDenied, "Not allowed to delete nodes from specified site"
 
         node.delete()
+
+       # Logging variables
        self.object_ids = [node['node_id']]
+       self.message = "Node %d deleted" % node['node_id']
 
         return 1