projects
/
invirt/packages/invirt-web.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
f9904f2
)
More fixes to hanging query in cherrypy compat
author
Steven Valdez
<dvorak42@mit.edu>
Tue, 30 Apr 2013 01:43:24 +0000
(21:43 -0400)
committer
Adam Glasgall
<adam@crossproduct.net>
Tue, 21 May 2013 00:51:34 +0000
(20:51 -0400)
code/cache_acls.py
patch
|
blob
|
history
code/controls.py
patch
|
blob
|
history
code/templates/functions.mako
patch
|
blob
|
history
code/validation.py
patch
|
blob
|
history
debian/changelog
patch
|
blob
|
history
diff --git
a/code/cache_acls.py
b/code/cache_acls.py
index
3c3d11e
..
46e5c73
100755
(executable)
--- a/
code/cache_acls.py
+++ b/
code/cache_acls.py
@@
-25,14
+25,14
@@
def refreshCache():
session.begin()
try:
session.begin()
try:
- machines = Machine.query().all()
+ machines = Machine.query.all()
for m in machines:
refreshMachine(m)
session.flush()
# Update the admin ACL as well
admin_acl = set(authz.expandAdmin(config.adminacl))
for m in machines:
refreshMachine(m)
session.flush()
# Update the admin ACL as well
admin_acl = set(authz.expandAdmin(config.adminacl))
- old_admin_acl = set(a.user for a in Admin.query())
+ old_admin_acl = set(a.user for a in Admin.query)
for removed in old_admin_acl - admin_acl:
old = Admin.query.filter_by(user=removed).first()
session.delete(old)
for removed in old_admin_acl - admin_acl:
old = Admin.query.filter_by(user=removed).first()
session.delete(old)
diff --git
a/code/controls.py
b/code/controls.py
index
6346002
..
09367e2
100644
(file)
--- a/
code/controls.py
+++ b/
code/controls.py
@@
-113,7
+113,7
@@
def createVm(username, state, owner, contact, name, description, memory, disksiz
session.save_or_update(machine)
disk = Disk(machine=machine,
guest_device_name='hda', size=disksize)
session.save_or_update(machine)
disk = Disk(machine=machine,
guest_device_name='hda', size=disksize)
- nic = NIC.query().filter_by(machine_id=None).filter_by(reusable=True).first()
+ nic = NIC.query.filter_by(machine_id=None).filter_by(reusable=True).first()
if not nic: #No IPs left!
raise CodeError("No IP addresses left! "
"Contact %s." % config.contact)
if not nic: #No IPs left!
raise CodeError("No IP addresses left! "
"Contact %s." % config.contact)
@@
-226,7
+226,7
@@
def commandResult(username, state, command_name, machine_id, fields):
machine = validation.Validate(username, state, machine_id=machine_id).machine
action = command_name
cdrom = fields.get('cdrom') or None
machine = validation.Validate(username, state, machine_id=machine_id).machine
action = command_name
cdrom = fields.get('cdrom') or None
- if cdrom is not None and not CDROM.query().filter_by(cdrom_id=cdrom).one():
+ if cdrom is not None and not CDROM.query.filter_by(cdrom_id=cdrom).one():
raise CodeError("Invalid cdrom type '%s'" % cdrom)
if action not in "reboot create destroy shutdown delete".split(" "):
raise CodeError("Invalid action '%s'" % action)
raise CodeError("Invalid cdrom type '%s'" % cdrom)
if action not in "reboot create destroy shutdown delete".split(" "):
raise CodeError("Invalid action '%s'" % action)
diff --git
a/code/templates/functions.mako
b/code/templates/functions.mako
index
f5a9166
..
7b46a35
100644
(file)
--- a/
code/templates/functions.mako
+++ b/
code/templates/functions.mako
@@
-15,12
+15,12
@@
onchange="${onchange}"\
</%def>
<%def name="cdromList(default='', onchange=None)">
</%def>
<%def name="cdromList(default='', onchange=None)">
-${databaseList(sorted(database.CDROM.query(), key=lambda x: x.description),
+${databaseList(sorted(database.CDROM.query, key=lambda x: x.description),
default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description')|n}
</%def>
<%def name="autoList(default='', onchange=None)">
default, onchange, 'cdrom', 'cdromlist', 'cdrom_id', 'description')|n}
</%def>
<%def name="autoList(default='', onchange=None)">
-${databaseList(sorted(database.Autoinstall.query(), key=lambda x: x.description),
+${databaseList(sorted(database.Autoinstall.query, key=lambda x: x.description),
default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')|n}
</%def>
default, onchange, 'autoinstall', 'autoinstalllist', 'autoinstall_id', 'description')|n}
</%def>
diff --git
a/code/validation.py
b/code/validation.py
index
d288a69
..
18666be
100755
(executable)
--- a/
code/validation.py
+++ b/
code/validation.py
@@
-57,13
+57,13
@@
class Validate:
if vmtype is not None:
self.vmtype = validVmType(vmtype)
if cdrom is not None:
if vmtype is not None:
self.vmtype = validVmType(vmtype)
if cdrom is not None:
- if not CDROM.query().get(cdrom):
+ if not CDROM.query.get(cdrom):
raise CodeError("Invalid cdrom type '%s'" % cdrom)
self.cdrom = cdrom
if autoinstall is not None:
#raise InvalidInput('autoinstall', 'install',
# "The autoinstaller has been temporarily disabled")
raise CodeError("Invalid cdrom type '%s'" % cdrom)
self.cdrom = cdrom
if autoinstall is not None:
#raise InvalidInput('autoinstall', 'install',
# "The autoinstaller has been temporarily disabled")
- self.autoinstall = Autoinstall.query().get(autoinstall)
+ self.autoinstall = Autoinstall.query.get(autoinstall)
def getMachinesByOwner(owner, machine=None):
def getMachinesByOwner(owner, machine=None):
@@
-74,7
+74,7
@@
def getMachinesByOwner(owner, machine=None):
"""
if machine:
owner = machine.owner
"""
if machine:
owner = machine.owner
- return Machine.query().filter_by(owner=owner)
+ return Machine.query.filter_by(owner=owner)
def maxMemory(owner, g, machine=None, on=True):
"""Return the maximum memory for a machine or a user.
def maxMemory(owner, g, machine=None, on=True):
"""Return the maximum memory for a machine or a user.
@@
-107,7
+107,7
@@
def maxDisk(owner, machine=None):
machine_id = machine.machine_id
else:
machine_id = None
machine_id = machine.machine_id
else:
machine_id = None
- disk_usage = Disk.query().filter(Disk.c.machine_id != machine_id).\
+ disk_usage = Disk.query.filter(Disk.c.machine_id != machine_id).\
join('machine').\
filter_by(owner=owner).sum(Disk.c.size) or 0
return min(quota_single, quota_total-disk_usage/1024.)
join('machine').\
filter_by(owner=owner).sum(Disk.c.size) or 0
return min(quota_single, quota_total-disk_usage/1024.)
@@
-181,7
+181,7
@@
def validDisk(owner, g, disk, machine=None):
def validVmType(vm_type):
if vm_type is None:
return None
def validVmType(vm_type):
if vm_type is None:
return None
- t = Type.query().get(vm_type)
+ t = Type.query.get(vm_type)
if t is None:
raise CodeError("Invalid vm type '%s'" % vm_type)
return t
if t is None:
raise CodeError("Invalid vm type '%s'" % vm_type)
return t
@@
-198,7
+198,7
@@
def testMachineId(user, state, machine_id, exists=True):
machine_id = int(machine_id)
except ValueError:
raise InvalidInput('machine_id', machine_id, "Must be an integer.")
machine_id = int(machine_id)
except ValueError:
raise InvalidInput('machine_id', machine_id, "Must be an integer.")
- machine = Machine.query().get(machine_id)
+ machine = Machine.query.get(machine_id)
if exists and machine is None:
raise InvalidInput('machine_id', machine_id, "Does not exist.")
if machine is not None and not haveAccess(user, state, machine):
if exists and machine is None:
raise InvalidInput('machine_id', machine_id, "Does not exist.")
if machine is not None and not haveAccess(user, state, machine):
diff --git
a/debian/changelog
b/debian/changelog
index
69d5471
..
5dafef0
100644
(file)
--- a/
debian/changelog
+++ b/
debian/changelog
@@
-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
-- Peter A. Iannucci <iannucci@mit.edu> Mon, 20 May 2013 09:00:00 -0400
+invirt-web (0.1.31~dvorak425) precise; urgency=low
+
+ * Fixing use of query() vs query on cherrypy.
+
+ -- Steven Valdez <dvorak42@mit.edu> Mon, 29 Apr 2013 21:43:31 -0400
+
invirt-web (0.1.31~dvorak424) precise; urgency=low
* Fixing cherrypy initialization for different versions.
invirt-web (0.1.31~dvorak424) precise; urgency=low
* Fixing cherrypy initialization for different versions.