From 3d6414330881304f5ab21d70df3a228d370843df Mon Sep 17 00:00:00 2001 From: Steven Valdez Date: Mon, 29 Apr 2013 22:44:39 -0400 Subject: [PATCH 1/1] sqlalchemy fixes to get web to display --- code/cache_acls.py | 4 ++-- code/controls.py | 8 ++++---- code/main.py | 10 +++++----- debian/changelog | 6 ++++++ 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/code/cache_acls.py b/code/cache_acls.py index 46e5c73..43af7dd 100755 --- a/code/cache_acls.py +++ b/code/cache_acls.py @@ -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 diff --git a/code/controls.py b/code/controls.py index 09367e2..a5f1693 100644 --- a/code/controls.py +++ b/code/controls.py @@ -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) diff --git a/code/main.py b/code/main.py index b443640..b712696 100755 --- a/code/main.py +++ b/code/main.py @@ -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() diff --git a/debian/changelog b/debian/changelog index 81276f0..2d877fc 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,12 @@ invirt-web (0.1.31) unstable; urgency=low -- Peter A. Iannucci 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 Mon, 29 Apr 2013 22:44:00 -0400 + invirt-web (0.1.31~dvorak426) precise; urgency=low * More sqlalchemy api fixes. -- 1.7.9.5