|
Lines 42-48
from univention.lib import fstab
Link Here
|
| 42 |
from univention.management.console import Translation |
42 |
from univention.management.console import Translation |
| 43 |
from univention.management.console.error import UMC_Error |
43 |
from univention.management.console.error import UMC_Error |
| 44 |
from univention.management.console.log import MODULE |
44 |
from univention.management.console.log import MODULE |
| 45 |
from univention.management.console.modules.decorators import sanitize, simple_response, threaded |
45 |
from univention.management.console.modules.decorators import sanitize, simple_response, threaded, SimpleThread |
| 46 |
from univention.management.console.modules.quota import tools |
46 |
from univention.management.console.modules.quota import tools |
| 47 |
from univention.management.console.modules.sanitizers import IntegerSanitizer, PatternSanitizer, StringSanitizer |
47 |
from univention.management.console.modules.sanitizers import IntegerSanitizer, PatternSanitizer, StringSanitizer |
| 48 |
|
48 |
|
|
Lines 68-75
class Commands(object):
Link Here
|
| 68 |
partitionDevice = request.options['partitionDevice'] |
68 |
partitionDevice = request.options['partitionDevice'] |
| 69 |
self._check_error(partitionDevice) |
69 |
self._check_error(partitionDevice) |
| 70 |
|
70 |
|
| 71 |
callback = functools.partial(self._users_query, partitionDevice, request) |
71 |
def _thread(request): |
| 72 |
tools.repquota(request.options['partitionDevice'], callback) |
72 |
stdout, returncode = tools.repquota(request.options['partitionDevice']) |
|
|
73 |
return self._users_query(partitionDevice, request, stdout, returncode) |
| 74 |
|
| 75 |
thread = SimpleThread('repquota', _thread, lambda r, t: self.thread_finished_callback(r, t, request)) |
| 76 |
thread.run(request) |
| 73 |
|
77 |
|
| 74 |
def _users_query(self, partition, request, stdout, status): |
78 |
def _users_query(self, partition, request, stdout, status): |
| 75 |
""" |
79 |
""" |
|
Lines 82-88
class Commands(object):
Link Here
|
| 82 |
devs = fstab.File() |
86 |
devs = fstab.File() |
| 83 |
devs.find(spec=partition) |
87 |
devs.find(spec=partition) |
| 84 |
|
88 |
|
| 85 |
callbackResult = stdout.read().splitlines() |
89 |
callbackResult = stdout.splitlines() |
| 86 |
|
90 |
|
| 87 |
# skip header |
91 |
# skip header |
| 88 |
header = 0 |
92 |
header = 0 |
|
Lines 93-100
class Commands(object):
Link Here
|
| 93 |
pass |
97 |
pass |
| 94 |
output = [x.decode('UTF-8', 'replace') for x in callbackResult[header + 1:]] |
98 |
output = [x.decode('UTF-8', 'replace') for x in callbackResult[header + 1:]] |
| 95 |
quotas = tools.repquota_parse(partition, output) |
99 |
quotas = tools.repquota_parse(partition, output) |
| 96 |
result = [q for q in quotas if request.options['filter'].match(q['user'])] |
100 |
return [q for q in quotas if request.options['filter'].match(q['user'])] |
| 97 |
self.finished(request.id, result) |
|
|
| 98 |
|
101 |
|
| 99 |
@sanitize( |
102 |
@sanitize( |
| 100 |
partitionDevice=StringSanitizer(required=True), |
103 |
partitionDevice=StringSanitizer(required=True), |