Returns 1 if updated successfully.
"""
+ roles = ['node']
+
nodenetwork_fields = dict(filter(can_update, NodeNetwork.fields.items()))
accepts = [
'primary_network': nodenetwork_fields,
'ssh_host_key': Node.fields['ssh_rsa_key']}
]
+
returns = Parameter(int, '1 if successful')
+ object_type = 'Node'
+
def call(self, auth, node_fields):
# Update node state
if node_fields.has_key('boot_state'):
if primary_network['nodenetwork_id'] not in self.caller['nodenetwork_ids']:
raise PLCInvalidArgument, "Node network not associated with calling node"
- nodenetworks = NodeNetworks(self.api, [primary_network['nodenetwork_id']]).values()
+ nodenetworks = NodeNetworks(self.api, [primary_network['nodenetwork_id']])
if not nodenetworks:
raise PLCInvalidArgument, "No such node network"
nodenetwork = nodenetworks[0]
nodenetwork.sync(commit = False)
self.caller.sync(commit = True)
+ self.message = "Node updated: %s" % ", ".join(node_fields.keys())
return 1