minor bugfix, and check not reusing names.
authorEric Price <ecprice@mit.edu>
Wed, 10 Oct 2007 02:29:20 +0000 (22:29 -0400)
committerEric Price <ecprice@mit.edu>
Wed, 10 Oct 2007 02:29:20 +0000 (22:29 -0400)
svn path=/trunk/web/; revision=163

templates/main.py

index 36ea239..bf40069 100755 (executable)
@@ -583,7 +583,10 @@ def testDisk(user, disksize, machine=None):
     return disksize
 
 def testName(user, name, machine=None):
-    return name
+    if Machine.select_by(name=name) == []:
+        return name
+    raise InvalidInput('name', name,
+                       "Already taken")
 
 def testHostname(user, hostname, machine):
     for nic in machine.nics:
@@ -640,6 +643,7 @@ def modify(user, fields):
         transaction.commit()
     except:
         transaction.rollback()
+        raise
     remctl("web", "moveregister", oldname, name)
     for disk in machine.disks:
         # XXX all disks get the same size on change?  Interface doesn't support more.