- return hostnames instead of node_ids
[plcapi.git] / PLC / Methods / UpdateNode.py
index 5530874..5440307 100644 (file)
@@ -44,9 +44,10 @@ class UpdateNode(Method):
         nodes = Nodes(self.api, [node_id_or_hostname])
         if not nodes:
             raise PLCInvalidArgument, "No such node"
-
         node = nodes[0]
-       PLCCheckLocalNode(node,"UpdateNode")
+
+        if node['peer_id'] is not None:
+            raise PLCInvalidArgument, "Not a local node"
 
         # Authenticated function
         assert self.caller is not None
@@ -59,6 +60,12 @@ class UpdateNode(Method):
 
         node.update(node_fields)
         node.sync()
+       
+       # Logging variables
        self.object_ids = [node['node_id']]
+       self.message = 'Node %d updated: %s.' % \
+               (node['node_id'], ", ".join(node_fields.keys()))
+       if 'boot_state' in node_fields.keys():
+               self.message += ' boot_state updated to %s' %  node_fields['boot_state']
 
         return 1