- use base class __init__() and delete() implementations
authorMark Huang <mlhuang@cs.princeton.edu>
Fri, 20 Oct 2006 17:51:32 +0000 (17:51 +0000)
committerMark Huang <mlhuang@cs.princeton.edu>
Fri, 20 Oct 2006 17:51:32 +0000 (17:51 +0000)
- don't look up NodeNetworks hostnames

PLC/Nodes.py

index 86dc061..0da2865 100644 (file)
@@ -4,7 +4,7 @@
 # Mark Huang <mlhuang@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: Nodes.py,v 1.10 2006/10/11 19:51:18 mlhuang Exp $
+# $Id: Nodes.py,v 1.11 2006/10/11 20:48:58 mlhuang Exp $
 #
 
 from types import StringTypes
@@ -52,17 +52,13 @@ class Node(Row):
         'session': Parameter(str, "(Admin only) Node session value", max = 256),
         '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),
+        '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),
         'ports': Parameter([int], "List of PCU ports that this node is connected to", ro = True),
         }
 
-    def __init__(self, api, fields):
-        Row.__init__(self, fields)
-        self.api = api
-
     def validate_hostname(self, hostname):
         if not valid_hostname(hostname):
             raise PLCInvalidArgument, "Invalid hostname"
@@ -72,12 +68,6 @@ class Node(Row):
             if 'node_id' not in self or self['node_id'] != node_id:
                 raise PLCInvalidArgument, "Hostname already in use"
 
-        # Check for conflicts with a nodenetwork hostname
-        conflicts = NodeNetworks(self.api, [hostname])
-        for nodenetwork_id in conflicts:
-            if 'nodenetwork_ids' not in self or nodenetwork_id not in self['nodenetwork_ids']:
-                raise PLCInvalidArgument, "Hostname already in use"
-
         return hostname
 
     def validate_boot_state(self, boot_state):