sqlalchemy fixes to get web to display
authorSteven Valdez <dvorak42@mit.edu>
Tue, 30 Apr 2013 02:44:39 +0000 (22:44 -0400)
committerAdam Glasgall <adam@crossproduct.net>
Tue, 21 May 2013 00:53:35 +0000 (20:53 -0400)
code/cache_acls.py
code/controls.py
code/main.py
debian/changelog

index 46e5c73..43af7dd 100755 (executable)
@@ -19,7 +19,7 @@ def refreshMachine(m):
     for p in people - old_people:
         ma = MachineAccess(user=p)
         m.acl.append(ma)
-        session.save_or_update(ma)
+        session.add(ma)
 
 def refreshCache():
     session.begin()
@@ -38,7 +38,7 @@ def refreshCache():
             session.delete(old)
         for added in admin_acl - old_admin_acl:
             a = Admin(user=added)
-            session.save_or_update(a)
+            session.add(a)
         session.flush()
     
         # Atomically execute our changes
index 09367e2..a5f1693 100644 (file)
@@ -110,7 +110,7 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz
         machine.uuid = uuidToString(randomUUID())
         machine.boot_off_cd = True
         machine.type = machine_type
-        session.save_or_update(machine)
+        session.add(machine)
         disk = Disk(machine=machine,
                     guest_device_name='hda', size=disksize)
         nic = NIC.query.filter_by(machine_id=None).filter_by(reusable=True).first()
@@ -119,8 +119,8 @@ def createVm(username, state, owner, contact, name, description, memory, disksiz
                             "Contact %s." % config.contact)
         nic.machine = machine
         nic.hostname = name
-        session.save_or_update(nic)
-        session.save_or_update(disk)
+        session.add(nic)
+        session.add(disk)
         cache_acls.refreshMachine(machine)
         makeDisks(machine)
         session.commit()
@@ -212,7 +212,7 @@ def deleteVM(machine):
         for nic in machine.nics:
             nic.machine_id = None
             nic.hostname = None
-            session.save_or_update(nic)
+            session.add(nic)
         for disk in machine.disks:
             session.delete(disk)
         session.delete(machine)
index b443640..b712696 100755 (executable)
@@ -286,7 +286,7 @@ console will suffer artifacts.
                                           machine_id=machine_id).machine
             d = infoDict(cherrypy.request.login, cherrypy.request.state, machine)
             return d
-        index = list
+        index = info
 
         @cherrypy.expose
         @cherrypy.tools.mako(filename="/info.mako")
@@ -549,7 +549,7 @@ def modifyDict(username, state, machine_id, fields):
         if hasattr(validate, 'contact'):
             machine.contact = validate.contact
 
-        session.save_or_update(machine)
+        session.add(machine)
         session.commit()
     except:
         session.rollback()
@@ -563,10 +563,10 @@ def modifyDict(username, state, machine_id, fields):
             if disk.size != disksize:
                 olddisk[disk.guest_device_name] = disksize
                 disk.size = disksize
-                session.save_or_update(disk)
+                session.add(disk)
         for diskname in olddisk:
             controls.resizeDisk(oldname, diskname, str(olddisk[diskname]))
-        session.save_or_update(machine)
+        session.add(machine)
         session.commit()
     except:
         session.rollback()
@@ -581,7 +581,7 @@ def modifyDict(username, state, machine_id, fields):
                     n.hostname = validate.name
         if hasattr(validate, 'name'):
             controls.renameMachine(machine, oldname, validate.name)
-        session.save_or_update(machine)
+        session.add(machine)
         session.commit()
     except:
         session.rollback()
index 81276f0..2d877fc 100644 (file)
@@ -4,6 +4,12 @@ invirt-web (0.1.31) unstable; urgency=low
 
  -- Peter A. Iannucci <iannucci@mit.edu>  Mon, 20 May 2013 09:00:00 -0400
 
+invirt-web (0.1.31~dvorak427) precise; urgency=low
+
+  * More updates to fix api changes.
+
+ -- Steven Valdez <dvorak42@mit.edu>  Mon, 29 Apr 2013 22:44:00 -0400
+
 invirt-web (0.1.31~dvorak426) precise; urgency=low
 
   * More sqlalchemy api fixes.