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))
- 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)
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)
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)
</%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)">
-${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>
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")
- self.autoinstall = Autoinstall.query().get(autoinstall)
+ self.autoinstall = Autoinstall.query.get(autoinstall)
def getMachinesByOwner(owner, machine=None):
"""
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.
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.)
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
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):
-- 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.