From f6f0164afcbada9498622842964024f6fb3e5dfa Mon Sep 17 00:00:00 2001 From: Mark Huang Date: Wed, 25 Oct 2006 14:29:13 +0000 Subject: [PATCH] - remove optional sub-parameter; we use these fields in both Add() and Update() methods, saying that a field is mandatory in Update() is both confusing and wrong --- PLC/AddressTypes.py | 4 ++-- PLC/Addresses.py | 10 +++++----- PLC/ConfFiles.py | 6 +++--- PLC/NodeGroups.py | 4 ++-- PLC/NodeNetworks.py | 8 ++++---- PLC/Nodes.py | 12 ++++++------ PLC/PCUs.py | 6 +++--- PLC/Persons.py | 14 +++++++------- PLC/Sites.py | 6 +++--- PLC/SliceAttributeTypes.py | 2 +- PLC/Slices.py | 2 +- 11 files changed, 37 insertions(+), 37 deletions(-) diff --git a/PLC/AddressTypes.py b/PLC/AddressTypes.py index 889b79dd..e117a298 100644 --- a/PLC/AddressTypes.py +++ b/PLC/AddressTypes.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: AddressTypes.py,v 1.4 2006/10/20 17:43:30 mlhuang Exp $ +# $Id: AddressTypes.py,v 1.5 2006/10/24 20:02:22 mlhuang Exp $ # from types import StringTypes @@ -23,7 +23,7 @@ class AddressType(Row): join_tables = ['address_address_type'] fields = { 'address_type_id': Parameter(int, "Address type identifier"), - 'name': Parameter(str, "Address type", max = 20, optional = False), + 'name': Parameter(str, "Address type", max = 20), 'description': Parameter(str, "Address type description", max = 254), } diff --git a/PLC/Addresses.py b/PLC/Addresses.py index 030821b1..667aa849 100644 --- a/PLC/Addresses.py +++ b/PLC/Addresses.py @@ -14,13 +14,13 @@ class Address(Row): join_tables = ['address_address_type', 'site_address'] fields = { 'address_id': Parameter(int, "Address identifier"), - 'line1': Parameter(str, "Address line 1", max = 254, optional = False), + 'line1': Parameter(str, "Address line 1", max = 254), 'line2': Parameter(str, "Address line 2", max = 254), 'line3': Parameter(str, "Address line 3", max = 254), - 'city': Parameter(str, "City", max = 254, optional = False), - 'state': Parameter(str, "State or province", max = 254, optional = False), - 'postalcode': Parameter(str, "Postal code", max = 64, optional = False), - 'country': Parameter(str, "Country", max = 128, optional = False), + 'city': Parameter(str, "City", max = 254), + 'state': Parameter(str, "State or province", max = 254), + 'postalcode': Parameter(str, "Postal code", max = 64), + 'country': Parameter(str, "Country", max = 128), 'address_type_ids': Parameter([int], "Address type identifiers", ro = True), 'address_types': Parameter([str], "Address types", ro = True), } diff --git a/PLC/ConfFiles.py b/PLC/ConfFiles.py index 0e579130..7eedcd0e 100644 --- a/PLC/ConfFiles.py +++ b/PLC/ConfFiles.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: ConfFiles.py,v 1.3 2006/10/24 13:46:43 mlhuang Exp $ +# $Id: ConfFiles.py,v 1.4 2006/10/24 20:02:22 mlhuang Exp $ # from PLC.Faults import * @@ -25,8 +25,8 @@ class ConfFile(Row): fields = { 'conf_file_id': Parameter(int, "Configuration file identifier"), 'enabled': Parameter(bool, "Configuration file is active"), - 'source': Parameter(str, "Relative path on the boot server where file can be downloaded", max = 255, optional = False), - 'dest': Parameter(str, "Absolute path where file should be installed", max = 255, optional = False), + 'source': Parameter(str, "Relative path on the boot server where file can be downloaded", max = 255), + 'dest': Parameter(str, "Absolute path where file should be installed", max = 255), 'file_permissions': Parameter(str, "chmod(1) permissions", max = 20), 'file_owner': Parameter(str, "chown(1) owner", max = 50), 'file_group': Parameter(str, "chgrp(1) owner", max = 50), diff --git a/PLC/NodeGroups.py b/PLC/NodeGroups.py index 4ccf4b88..23ab4f1c 100644 --- a/PLC/NodeGroups.py +++ b/PLC/NodeGroups.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: NodeGroups.py,v 1.13 2006/10/20 17:50:33 mlhuang Exp $ +# $Id: NodeGroups.py,v 1.14 2006/10/24 20:02:22 mlhuang Exp $ # from types import StringTypes @@ -27,7 +27,7 @@ class NodeGroup(Row): join_tables = ['nodegroup_node', 'conf_file_nodegroup'] fields = { 'nodegroup_id': Parameter(int, "Node group identifier"), - 'name': Parameter(str, "Node group name", max = 50, optional = False), + 'name': Parameter(str, "Node group name", max = 50), 'description': Parameter(str, "Node group description", max = 200), 'node_ids': Parameter([int], "List of nodes in this node group"), 'conf_file_ids': Parameter([int], "List of configuration files specific to this node group"), diff --git a/PLC/NodeNetworks.py b/PLC/NodeNetworks.py index e62b0fca..0bdf8c49 100644 --- a/PLC/NodeNetworks.py +++ b/PLC/NodeNetworks.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: NodeNetworks.py,v 1.9 2006/10/20 17:51:08 mlhuang Exp $ +# $Id: NodeNetworks.py,v 1.10 2006/10/24 20:02:22 mlhuang Exp $ # from types import StringTypes @@ -49,8 +49,8 @@ class NodeNetwork(Row): primary_key = 'nodenetwork_id' fields = { 'nodenetwork_id': Parameter(int, "Node interface identifier"), - 'method': Parameter(str, "Addressing method (e.g., 'static' or 'dhcp')", optional = False), - 'type': Parameter(str, "Address type (e.g., 'ipv4')", optional = False), + 'method': Parameter(str, "Addressing method (e.g., 'static' or 'dhcp')"), + 'type': Parameter(str, "Address type (e.g., 'ipv4')"), 'ip': Parameter(str, "IP address"), 'mac': Parameter(str, "MAC address"), 'gateway': Parameter(str, "IP address of primary gateway"), @@ -61,7 +61,7 @@ class NodeNetwork(Row): 'dns2': Parameter(str, "IP address of secondary DNS server"), 'bwlimit': Parameter(int, "Bandwidth limit", min = 0), 'hostname': Parameter(str, "(Optional) Hostname"), - 'node_id': Parameter(int, "Node associated with this interface", optional = False), + 'node_id': Parameter(int, "Node associated with this interface"), 'is_primary': Parameter(bool, "Is the primary interface for this node"), } diff --git a/PLC/Nodes.py b/PLC/Nodes.py index 7851fdba..6356c397 100644 --- a/PLC/Nodes.py +++ b/PLC/Nodes.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: Nodes.py,v 1.12 2006/10/20 17:51:32 mlhuang Exp $ +# $Id: Nodes.py,v 1.13 2006/10/24 20:02:22 mlhuang Exp $ # from types import StringTypes @@ -39,15 +39,15 @@ class Node(Row): primary_key = 'node_id' fields = { 'node_id': Parameter(int, "Node identifier"), - 'hostname': Parameter(str, "Fully qualified hostname", max = 255, optional = False), - 'site_id': Parameter(int, "Site at which this node is located", optional = False), - 'boot_state': Parameter(str, "Boot state", max = 20, optional = False), + 'hostname': Parameter(str, "Fully qualified hostname", max = 255), + 'site_id': Parameter(int, "Site at which this node is located"), + 'boot_state': Parameter(str, "Boot state", max = 20), 'model': Parameter(str, "Make and model of the actual machine", max = 255), '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", ro = True), - 'last_updated': Parameter(str, "Date and time when node entry was created", ro = True), + 'date_created': Parameter(int, "Date and time when node entry was created", ro = True), + 'last_updated': Parameter(int, "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", ro = True), diff --git a/PLC/PCUs.py b/PLC/PCUs.py index 81c01c41..57ec44cf 100644 --- a/PLC/PCUs.py +++ b/PLC/PCUs.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: PCUs.py,v 1.4 2006/10/20 17:56:36 mlhuang Exp $ +# $Id: PCUs.py,v 1.5 2006/10/24 20:02:22 mlhuang Exp $ # from PLC.Faults import * @@ -25,9 +25,9 @@ class PCU(Row): join_tables = ['pcu_node'] fields = { 'pcu_id': Parameter(int, "PCU identifier"), - 'site_id': Parameter(int, "Identifier of site where PCU is located", optional = False), + 'site_id': Parameter(int, "Identifier of site where PCU is located"), 'hostname': Parameter(str, "PCU hostname", max = 254), - 'ip': Parameter(str, "PCU IP address", max = 254, optional = False), + 'ip': Parameter(str, "PCU IP address", max = 254), 'protocol': Parameter(str, "PCU protocol, e.g. ssh, https, telnet", max = 16), 'username': Parameter(str, "PCU username", max = 254), 'password': Parameter(str, "PCU username", max = 254), diff --git a/PLC/Persons.py b/PLC/Persons.py index 970e6e05..d8915198 100644 --- a/PLC/Persons.py +++ b/PLC/Persons.py @@ -4,7 +4,7 @@ # Mark Huang # Copyright (C) 2006 The Trustees of Princeton University # -# $Id: Persons.py,v 1.12 2006/10/20 17:52:24 mlhuang Exp $ +# $Id: Persons.py,v 1.13 2006/10/24 20:02:22 mlhuang Exp $ # from types import StringTypes @@ -33,17 +33,17 @@ class Person(Row): primary_key = 'person_id' fields = { 'person_id': Parameter(int, "Account identifier"), - 'first_name': Parameter(str, "Given name", max = 128, optional = False), - 'last_name': Parameter(str, "Surname", max = 128, optional = False), + 'first_name': Parameter(str, "Given name", max = 128), + 'last_name': Parameter(str, "Surname", max = 128), 'title': Parameter(str, "Title", max = 128), - 'email': Parameter(str, "Primary e-mail address", max = 254, optional = False), + 'email': Parameter(str, "Primary e-mail address", max = 254), 'phone': Parameter(str, "Telephone number", max = 64), 'url': Parameter(str, "Home page", max = 254), 'bio': Parameter(str, "Biography", max = 254), 'enabled': Parameter(bool, "Has been enabled"), - 'password': Parameter(str, "Account password in crypt() form", max = 254, optional = False), - 'last_updated': Parameter(str, "Date and time of last update", ro = True), - 'date_created': Parameter(str, "Date and time when account was created", ro = True), + 'password': Parameter(str, "Account password in crypt() form", max = 254), + 'last_updated': Parameter(int, "Date and time of last update", ro = True), + 'date_created': Parameter(int, "Date and time when account was created", ro = True), 'role_ids': Parameter([int], "List of role identifiers", ro = True), 'roles': Parameter([str], "List of roles", ro = True), 'site_ids': Parameter([int], "List of site identifiers", ro = True), diff --git a/PLC/Sites.py b/PLC/Sites.py index da7373b3..b345a04f 100644 --- a/PLC/Sites.py +++ b/PLC/Sites.py @@ -23,9 +23,9 @@ class Site(Row): primary_key = 'site_id' fields = { 'site_id': Parameter(int, "Site identifier"), - 'name': Parameter(str, "Full site name", max = 254, optional = False), - 'abbreviated_name': Parameter(str, "Abbreviated site name", max = 50, optional = False), - 'login_base': Parameter(str, "Site slice prefix", max = 20, optional = False), + 'name': Parameter(str, "Full site name", max = 254), + 'abbreviated_name': Parameter(str, "Abbreviated site name", max = 50), + 'login_base': Parameter(str, "Site slice prefix", max = 20), 'is_public': Parameter(bool, "Publicly viewable site"), 'latitude': Parameter(float, "Decimal latitude of the site", min = -90.0, max = 90.0), 'longitude': Parameter(float, "Decimal longitude of the site", min = -180.0, max = 180.0), diff --git a/PLC/SliceAttributeTypes.py b/PLC/SliceAttributeTypes.py index 8c05eeae..2f6132ce 100644 --- a/PLC/SliceAttributeTypes.py +++ b/PLC/SliceAttributeTypes.py @@ -16,7 +16,7 @@ class SliceAttributeType(Row): join_tables = ['slice_attribute'] fields = { 'attribute_type_id': Parameter(int, "Slice attribute type identifier"), - 'name': Parameter(str, "Slice attribute type name", max = 100, optional = False), + 'name': Parameter(str, "Slice attribute type name", max = 100), 'description': Parameter(str, "Slice attribute type description", max = 254), 'min_role_id': Parameter(int, "Minimum (least powerful) role that can set or change this attribute"), } diff --git a/PLC/Slices.py b/PLC/Slices.py index 02c34c33..fe728631 100644 --- a/PLC/Slices.py +++ b/PLC/Slices.py @@ -23,7 +23,7 @@ class Slice(Row): fields = { 'slice_id': Parameter(int, "Slice identifier"), 'site_id': Parameter(int, "Identifier of the site to which this slice belongs"), - 'name': Parameter(str, "Slice name", max = 32, optional = False), + 'name': Parameter(str, "Slice name", max = 32), 'instantiation': Parameter(str, "Slice instantiation state"), 'url': Parameter(str, "URL further describing this slice", max = 254), 'description': Parameter(str, "Slice description", max = 2048), -- 2.47.0