Merge remote-tracking branch 'origin/pycurl' into planetlab-4_0-branch
[plcapi.git] / PLC / Methods / AddNodeToNodeGroup.py
index 336387b..a552b11 100644 (file)
@@ -32,7 +32,9 @@ class AddNodeToNodeGroup(Method):
        if not nodes:
                raise PLCInvalidArgument, "No such node"
        node = nodes[0]
-       PLCCheckLocalNode (node,"AddNodeToNodeGroup")
+
+        if node['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local node"
 
        # Get nodegroup info
         nodegroups = NodeGroups(self.api, [nodegroup_id_or_name])
@@ -44,6 +46,10 @@ class AddNodeToNodeGroup(Method):
        # add node to nodegroup
         if node['node_id'] not in nodegroup['node_ids']:
             nodegroup.add_node(node)
-       self.object_ids = [nodegroup['nodegroup_id']]
-
+       
+       # Logging variables
+       self.event_objects = {'NodeGroup': [nodegroup['nodegroup_id']],
+                             'Node': [node['node_id']]}
+       self.message = 'Node %d added to node group %d' % \
+               (node['node_id'], nodegroup['nodegroup_id'])
         return 1