# Mark Huang <mlhuang@cs.princeton.edu>
# Copyright (C) 2006 The Trustees of Princeton University
#
-# $Id: Nodes.py,v 1.6 2006/10/02 15:21:03 mlhuang Exp $
+# $Id: Nodes.py,v 1.7 2006/10/02 16:04:42 mlhuang Exp $
#
from types import StringTypes
'boot_nonce': Parameter(str, "(Admin only) Random value generated by the node at last boot", max = 128),
'version': Parameter(str, "Apparent Boot CD version", max = 64),
'ssh_rsa_key': Parameter(str, "Last known SSH host key", max = 1024),
- 'date_created': Parameter(str, "Date and time when node entry was created"),
- 'last_updated': Parameter(str, "Date and time when node entry was created"),
+ 'date_created': Parameter(str, "Date and time when node entry was created", ro = True),
+ 'last_updated': Parameter(str, "Date and time when node entry was created", ro = True),
'key': Parameter(str, "(Admin only) Node key", max = 256),
'session': Parameter(str, "(Admin only) Node session value", max = 256),
- 'nodenetwork_ids': Parameter([int], "List of network interfaces that this node has"),
- 'nodegroup_ids': Parameter([int], "List of node groups that this node is in"),
- # 'conf_file_ids': Parameter([int], "List of configuration files specific to this node"),
- # 'root_person_ids': Parameter([int], "(Admin only) List of people who have root access to this node"),
- 'slice_ids': Parameter([int], "List of slices on this node"),
- # 'pcu_ids': Parameter([int], "List of PCUs that control this node"),
+ 'nodenetwork_ids': Parameter([int], "List of network interfaces that this node has", ro = True),
+ 'nodegroup_ids': Parameter([int], "List of node groups that this node is in", ro = True),
+ # 'conf_file_ids': Parameter([int], "List of configuration files specific to this node", ro = True),
+ # 'root_person_ids': Parameter([int], "(Admin only) List of people who have root access to this node", ro = True),
+ 'slice_ids': Parameter([int], "List of slices on this node", ro = True),
+ # 'pcu_ids': Parameter([int], "List of PCUs that control this node", ro = True),
}
def __init__(self, api, fields):
# Filter out fields that cannot be set or updated directly
nodes_fields = self.api.db.fields('nodes')
- fields = dict(filter(lambda (key, value): key in nodes_fields,
+ fields = dict(filter(lambda (key, value): \
+ key in nodes_fields and \
+ (key not in self.fields or not self.fields[key].ro),
self.items()))
- for ro_field in 'date_created', 'last_updated':
- if ro_field in fields:
- del fields[ro_field]
# Parameterize for safety
keys = fields.keys()