Univention Bugzilla – Full Text Bug Listing |
Summary: | _err2str fails if ldap exception is not a dict | ||
---|---|---|---|
Product: | UCS | Reporter: | Florian Best <best> |
Component: | UDM (Generic) | Assignee: | Florian Best <best> |
Status: | CLOSED FIXED | QA Contact: | Drees Dormann <dormann> |
Severity: | normal | ||
Priority: | P5 | CC: | walkenhorst |
Version: | UCS 4.0 | ||
Target Milestone: | UCS 4.0-2-errata | ||
Hardware: | Other | ||
OS: | Linux | ||
What kind of report is it?: | --- | What type of bug is this?: | --- |
Who will be affected by this bug?: | --- | How will those affected feel about the bug?: | --- |
User Pain: | Enterprise Customer affected?: | ||
School Customer affected?: | ISV affected?: | ||
Waiting Support: | Flags outvoted (downgraded) after PO Review: | ||
Ticket number: | Bug group (optional): | Error handling, External feedback | |
Max CVSS v3 score: | |||
Attachments: | patch |
python-ldap violates it's own documentation here: http://python-ldap.org/doc/html/ldap.html#exceptions Previously: >>> import ldap >>> from univention.admin.uldap import _err2str >>> _err2str(ldap.TIMEOUT("LDAP time limit (%d secs) exceeded.")) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.7/univention/admin/uldap.py", line 82, in _err2str msg = ': '.join([str(m) for m in (iarg.get('desc'), iarg.get('info')) if m]) AttributeError: 'str' object has no attribute 'get' Afterwards: >>> import ldap >>> from univention.admin.uldap import _err2str >>> _err2str(ldap.TIMEOUT("LDAP time limit (%d secs) exceeded.")) 'LDAP time limit (%d secs) exceeded.' Fix: svn r60938 YAML: 2015-05-28-univention-directory-manager-modules.yaml Fix: OK YAML: OK Reported again, (from intern/support?), 4.0-2 errata194 (Walle) Reported again, 4.0-2 errata213 (Walle) |
Created attachment 6926 [details] patch We received the following traceback, 4.0-2 errata194 (Walle): Die Ausführung des Kommandos udm/syntax/choices/info users/user ist fehlgeschlagen: Traceback (most recent call last): File "%PY2.7%/univention/management/console/modules/__init__.py", line 176, in _decorated return function(self, request, *args, **kwargs) File "%PY2.7%/univention/management/console/modules/decorators.py", line 316, in _response result = _multi_response(self, request) File "%PY2.7%/univention/management/console/modules/decorators.py", line 460, in _response return list(function(self, iterator, *nones)) File "%PY2.7%/univention/management/console/modules/decorators.py", line 282, in _fake_func yield function(self, *args) File "%PY2.7%/univention/management/console/modules/udm/__init__.py", line 923, in syntax_choices_info return info_syntax_choices(syntax) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 1315, in info_syntax_choices size += len(module.search(filter=filter_s, simple=not syn.use_objects)) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 163, in _decorated return func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 146, in wrapper_func return _func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 139, in _func ret = func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/udm/udm_ldap.py", line 582, in search result = self.module.lookup(None, ldap_connection, filter_s, base=container, superordinate=superordinate, scope=scope, sizelimit=sizelimit) File "%PY2.7%/univention/admin/handlers/computers/computer.py", line 175, in lookup res.extend( computer.lookup(co, lo, filter_s, base, superordinate, scope, unique, required, timeout, sizelimit) ) File "%PY2.7%/univention/admin/handlers/computers/memberserver.py", line 721, in lookup for dn, attrs in lo.search(unicode(filter), base, scope, [], unique, required, timeout, sizelimit): File "%PY2.7%/univention/admin/uldap.py", line 358, in search raise univention.admin.uexceptions.ldapError(_err2str(msg), original_exception=msg) File "%PY2.7%/univention/admin/uldap.py", line 82, in _err2str msg = ': '.join([str(m) for m in (iarg.get('desc'), iarg.get('info')) if m]) AttributeError: 'str' object has no attribute 'get' Remark: Benutzer aufgerufen I had a quick look into python-ldap. There are some exceptions which doesn't have a dict as argument. Instead exceptions are raised with a string: ./controls/__init__.py: raise ldap.UNAVAILABLE_CRITICAL_EXTENSION('Received unexpected critical response control with controlType %s' % (repr(controlType))) ./ldapobject.py: raise ldap.PROTOCOL_ERROR("Wrong OID in extended response! Expected %s, got %s" % (extop_resp_class.responseName,respoid)) ./ldapobject.py: raise NO_UNIQUE_ENTRY('No or non-unique search result for %s' % (repr(filterstr))) ./ldapobject.py: raise ldap.TIMEOUT( "LDAP time limit (%d secs) exceeded." % (timeout) ) Attached is a patch which fixes it.