Univention Bugzilla – Attachment 10177 Details for
Bug 46790
Better error messages for activation wizard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Catch stderr
46790.patch (text/plain), 1.64 KB, created by
Jürn Brodersen
on 2019-09-10 10:25:48 CEST
(
hide
)
Description:
Catch stderr
Filename:
MIME Type:
Creator:
Jürn Brodersen
Created:
2019-09-10 10:25:48 CEST
Size:
1.64 KB
patch
obsolete
>diff --git a/base/univention-system-activation/src/wsgi.py b/base/univention-system-activation/src/wsgi.py >index 994adeafb7..8b47a8bd8b 100644 >--- a/base/univention-system-activation/src/wsgi.py >+++ b/base/univention-system-activation/src/wsgi.py >@@ -70,6 +70,10 @@ def clean_license_output(out): > > > def application(environ, start_response): >+ >+ class LdapLicenceFetchError(Exception): >+ pass >+ > def _error(message, trace=None): > return { > 'status': 500, >@@ -92,13 +96,16 @@ def application(environ, start_response): > > # output the license upon GET request > if environ.get('REQUEST_METHOD') == 'GET': >+ cmd = ['usr/bin/sudo', '/usr/bin/univention-ldapsearch', '-LLL', 'objectClass=univentionLicense'] >+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) > try: >- out = subprocess.check_output(['/usr/bin/sudo', '/usr/bin/univention-ldapsearch', '-LLL', 'objectClass=univentionLicense']) >+ out, err = proc.communicate() >+ if proc.returncode: >+ raise LdapLicenceFetchError('cmd: {}\nreturn code: {}\nstdout: {}\nstderr: {}'.format(cmd, proc.returncode, out, err)) > out = clean_license_output(out) > return _finish(data=out) >- except subprocess.CalledProcessError as exc: >- _log('Failed to read license data from LDAP:\n%s' % exc) >- return _finish('500 Internal Server Error', _error('Failed to read license data from LDAP:\n%s' % exc)) >+ except LdapLicenceFetchError as exc: >+ return _finish('500 Internal Server Error', data=_error('Could not fetch licence from ldap', traceback.format_exc())) > except Exception as exc: > return _finish('500 Internal Server Error', data=_error(str(exc), traceback.format_exc())) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 46790
:
10166
| 10177