Bug 30088 - improve exception messages for admin.uexceptions classes
improve exception messages for admin.uexceptions classes
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UCS 3.1
Other Linux
: P3 minor (vote)
: UCS 4.0-0-errata
Assigned To: Florian Best
Alexander Kläser
:
: 33928 (view as bug list)
Depends on: 27940
Blocks: 30089
  Show dependency treegraph
 
Reported: 2013-01-21 12:15 CET by Florian Best
Modified: 2015-01-29 11:46 CET (History)
7 users (show)

See Also:
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): Cleanup
Max CVSS v3 score:
best: Patch_Available+


Attachments
e.patch (deleted)
2013-01-21 12:15 CET, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2013-01-21 12:15:58 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 +++
Comment 1 Florian Best univentionstaff 2014-12-04 00:15:22 CET
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
Comment 2 Florian Best univentionstaff 2014-12-04 16:47:51 CET
*** Bug 33928 has been marked as a duplicate of this bug. ***
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2015-01-05 14:03:17 CET
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).
Comment 4 Florian Best univentionstaff 2015-01-05 14:12:55 CET
(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.
Comment 5 Arvid Requate univentionstaff 2015-01-14 13:10:53 CET
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.
Comment 6 Florian Best univentionstaff 2015-01-14 13:25:52 CET
Ẁ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.
Comment 7 Florian Best univentionstaff 2015-01-14 15:21:35 CET
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
Comment 8 Arvid Requate univentionstaff 2015-01-14 16:14:04 CET
Ok, 138sync_gpo works again.
Comment 9 Alexander Kläser univentionstaff 2015-01-21 14:48:44 CET
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.
Comment 10 Florian Best univentionstaff 2015-01-21 14:53:07 CET
fixed
Comment 11 Alexander Kläser univentionstaff 2015-01-21 15:27:06 CET
Changes: OK
Package version: OK
YAML entry: OK
Comment 12 Janek Walkenhorst univentionstaff 2015-01-22 11:56:09 CET
<http://errata.univention.de/ucs/4.0/43.html>
Comment 13 Janek Walkenhorst univentionstaff 2015-01-29 11:46:12 CET
<http://errata.univention.de/ucs/4.0/62.html>