diff --git base/univention-quota/umc/python/quota/tools.py base/univention-quota/umc/python/quota/tools.py index e65351a794..6c72b2a882 100644 --- base/univention-quota/umc/python/quota/tools.py +++ base/univention-quota/umc/python/quota/tools.py @@ -42,8 +42,6 @@ import os import re import subprocess -import tornado.process - import univention.management.console as umc from univention.config_registry import handler_set from univention.lib import fstab @@ -83,7 +81,7 @@ class UserQuota(dict): self[time] = value -def repquota(partition, callback): +def repquota(partition): # find filesystem type fs = fstab.File() part = fs.find(spec=partition) @@ -94,8 +92,9 @@ def repquota(partition, callback): # -C == do not try to resolve all users at once # -v == verbose cmd = ['/usr/sbin/repquota', '-C', '-v', partition] + args - proc = tornado.process.Subprocess(cmd, stdout=subprocess.PIPE) - proc.set_exit_callback(functools.partial(callback, proc.stdout)) + proc = subprocess.Popen(cmd, stdout=subprocess.PIPE) + stdout, stderr = proc.communicate() + return (stdout, proc.returncode) def repquota_parse(partition, output): diff --git base/univention-quota/umc/python/quota/user.py base/univention-quota/umc/python/quota/user.py index e5451bc04d..9822de34bd 100644 --- base/univention-quota/umc/python/quota/user.py +++ base/univention-quota/umc/python/quota/user.py @@ -42,7 +42,7 @@ from univention.lib import fstab from univention.management.console import Translation from univention.management.console.error import UMC_Error from univention.management.console.log import MODULE -from univention.management.console.modules.decorators import sanitize, simple_response, threaded +from univention.management.console.modules.decorators import sanitize, simple_response, threaded, SimpleThread from univention.management.console.modules.quota import tools from univention.management.console.modules.sanitizers import IntegerSanitizer, PatternSanitizer, StringSanitizer @@ -68,8 +68,12 @@ class Commands(object): partitionDevice = request.options['partitionDevice'] self._check_error(partitionDevice) - callback = functools.partial(self._users_query, partitionDevice, request) - tools.repquota(request.options['partitionDevice'], callback) + def _thread(request): + stdout, returncode = tools.repquota(request.options['partitionDevice']) + return self._users_query(partitionDevice, request, stdout, returncode) + + thread = SimpleThread('repquota', _thread, lambda r, t: self.thread_finished_callback(r, t, request)) + thread.run(request) def _users_query(self, partition, request, stdout, status): """ @@ -82,7 +86,7 @@ class Commands(object): devs = fstab.File() devs.find(spec=partition) - callbackResult = stdout.read().splitlines() + callbackResult = stdout.splitlines() # skip header header = 0 @@ -93,8 +97,7 @@ class Commands(object): pass output = [x.decode('UTF-8', 'replace') for x in callbackResult[header + 1:]] quotas = tools.repquota_parse(partition, output) - result = [q for q in quotas if request.options['filter'].match(q['user'])] - self.finished(request.id, result) + return [q for q in quotas if request.options['filter'].match(q['user'])] @sanitize( partitionDevice=StringSanitizer(required=True),