Univention Bugzilla – Bug 30088
improve exception messages for admin.uexceptions classes
Last modified: 2015-01-29 11:46:12 CET
Created attachment 4995 [details] e.patch The get_exception_msg function should be moved into admin.uexceptions and the udm base exception should implement __str__. See attached patch. +++ This bug was initially created as a clone of Bug #27940 +++
The univention.admin.uexceptions.base class has been adapted with a __str__ method. This has the advantage that the exceptions look the same in UMC-UDM and on UDM CLI. They are also now more detailed on CLI. The raised univention.admin.uexceptions.noObject class is now always raised with the proper information: either the DN is given as argument, or if not present because it is raised in a search()/searchDn() call the LDAP filter is added to the arguments. This has the advantage that we will receive more detailed error information when users are providing traceback feedback. Fix: svn r56399 and svn r56419 and svn r56439 Package: univention-directory-manager-modules (10.0.29-7) YAML: 2014-11-28-univention-directory-manager-modules.yaml Downgradeable to UCS 3.2-4: possible
*** Bug 33928 has been marked as a duplicate of this bug. ***
Just a sidenote: this change seem to cause problems in error cases in UCS@school which have been cought properly in the past (→ Bug 37375).
(In reply to Sönke Schwardt-Krummrich from comment #3) > Just a sidenote: this change seem to cause problems in error cases in > UCS@school which have been cought properly in the past (→ Bug 37375). yes, I could restore the previous behavior for that specific exception. The way how the exception is used is wrong/error prone in UCS@school nevertheless.
Note: This also breaks subtree delete handling in the S4-Connector, at modules/univention/s4connector/__init__.py +1306: ============================================================================ except Exception, e: ud.debug(ud.LDAP, ud.INFO,"delete object exception: %s"%e) if str(e).startswith("Operation not allowed on non-leaf"): # need to delete subtree ============================================================================ This e.g. currently causes the GPO delete Sync S4->UCS to fail, see ucs-test case 52_s4connector/138sync_gpo. Due to the change of this bug, the modified exception message "LDAP Error Operation not allowed on non-leaf: subordinate objects must be deleted first" is not recognized any longer. Agreed, it's not good style to match on Exception messages, but we need to check first thoroughly if this low level change doesn't break other code too. So either check our code and file enhancement bugs which block this one or you have to revert the changes made here.
Ẁell, I suggest to add either a method to_error_message() or implement __unicode__ instead of __str__. Also: original_exception and original_traceback attributes would be good.
The __str__ method has been reverted/removed and reintegrated into a good place in the UDM module. The ldapError method has been adapted to the attribute original_exception → so we don't need to parse the str(exc) in the future anymore. In UDM we are able to remove the workaround in @LDAP_Connection. svn r57316 r57317 2014-11-28-univention-directory-manager-modules.yaml 2015-01-08-univention-management-console-module-udm.yaml
Ok, 138sync_gpo works again.
root@ucs-6489:~# udm users/user list --filter 'uid=(' uid=( ('Bad search filter', "filter=u'(&(|(&(objectClass=posixAccount)(objectClass=shadowAccount))(objectClass=univentionMail)(objectClass=sambaSamAccount)(objectClass=simpleSecurityObject)(&(objectClass=person)(objectClass=organizationalPerson)(objectClass=inetOrgPerson)))(!(uidNumber=0))(!(uid=*$))(!(univentionObjectFlag=functional))(uid=())'") This does not look very nice as tuple, though.
fixed
Changes: OK Package version: OK YAML entry: OK
<http://errata.univention.de/ucs/4.0/43.html>
<http://errata.univention.de/ucs/4.0/62.html>