projects
/
invirt/packages/invirt-web.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Nicer error message on admin not being a group.
[invirt/packages/invirt-web.git]
/
code
/
main.py
diff --git
a/code/main.py
b/code/main.py
index
8bc9ece
..
98fe1a8
100755
(executable)
--- a/
code/main.py
+++ b/
code/main.py
@@
-136,7
+136,7
@@
def hasVnc(status):
def parseCreate(user, fields):
name = fields.getfirst('name')
if not validation.validMachineName(name):
def parseCreate(user, fields):
name = fields.getfirst('name')
if not validation.validMachineName(name):
- raise InvalidInput('name', name, 'You must provide a machine name.')
+ raise InvalidInput('name', name, 'You must provide a machine name. Max 22 chars, alnum plus \'-\' and \'_\'.')
name = name.lower()
if Machine.get_by(name=name):
name = name.lower()
if Machine.get_by(name=name):
@@
-210,6
+210,9
@@
def getListDict(user):
owner=user,
cdrom='gutsy-i386')
checkpoint.checkpoint('Got defaults')
owner=user,
cdrom='gutsy-i386')
checkpoint.checkpoint('Got defaults')
+ def sortkey(machine):
+ return (machine.owner != user, machine.owner, machine.name)
+ machines = sorted(machines, key=sortkey)
d = dict(user=user,
cant_add_vm=validation.cantAddVm(user),
max_memory=max_memory,
d = dict(user=user,
cant_add_vm=validation.cantAddVm(user),
max_memory=max_memory,
@@
-344,9
+347,9
@@
def command(user, fields):
return templates.list(searchList=[d])
elif back == 'info':
machine = validation.testMachineId(user, fields.getfirst('machine_id'))
return templates.list(searchList=[d])
elif back == 'info':
machine = validation.testMachineId(user, fields.getfirst('machine_id'))
- d = infoDict(user, machine)
- d['result'] = result
- return templates.info(searchList=[d])
+ return ({'Status': '302',
+ 'Location': '/info?machine_id=%d' % machine.machine_id},
+ "You shouldn't see this message.")
else:
raise InvalidInput('back', back, 'Not a known back page.')
else:
raise InvalidInput('back', back, 'Not a known back page.')
@@
-448,7
+451,7
@@
The administrator field determines who can access the console and
power on and off the machine. This can be either a user or a moira
group.""",
quotas="""
power on and off the machine. This can be either a user or a moira
group.""",
quotas="""
-Quotas are determined on a per-locker basis. Each quota may have a
+Quotas are determined on a per-locker basis. Each locker may have a
maximum of 512 megabytes of active ram, 50 gigabytes of disk, and 4
active machines.""",
console="""
maximum of 512 megabytes of active ram, 50 gigabytes of disk, and 4
active machines.""",
console="""
@@
-613,7
+616,7
@@
def main(operation, user, fields):
output_string = str(output)
checkpoint.checkpoint('output as a string')
print output_string
output_string = str(output)
checkpoint.checkpoint('output as a string')
print output_string
- print '<pre>%s</pre>' % checkpoint
+ print '<!-- <pre>%s</pre> -->' % checkpoint
except Exception, err:
if not fields.has_key('js'):
if isinstance(err, CodeError):
except Exception, err:
if not fields.has_key('js'):
if isinstance(err, CodeError):