Bug 35273 - traceback caused by get_exception_msg()
traceback caused by get_exception_msg()
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain management (Generic)
UCS 3.2
Other Linux
: P5 normal (vote)
: UCS 4.0-0-errata
Assigned To: Florian Best
Dirk Wiesenthal
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-07-07 09:30 CEST by Florian Best
Modified: 2015-01-26 10:19 CET (History)
3 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): Error handling, External feedback
Max CVSS v3 score:


Attachments
patch for one problem (1.81 KB, patch)
2014-11-28 23:27 CET, Florian Best
Details | Diff
patch for all 4 problems (9.63 KB, patch)
2014-11-29 00:08 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 2014-07-07 09:30:51 CEST
This function causes the following traceback, as received by a feedback-report.
  73 def get_exception_msg(e):
  74 »   msg = getattr(e, 'message', '')
  75 »   if getattr(e, 'args', False):
  76 »   »   if e.args[0] != msg or len(e.args) != 1:
  77 »   »   »   for arg in e.args:
  78 »   »   »   »   msg += ' ' + arg
  79 »   return msg

Traceback:
  File "/usr/lib/pymodules/python2.6/notifier/threads.py", line 82, in _run
    tmp = self._function()
  File "/usr/lib/pymodules/python2.6/notifier/__init__.py", line 104, in __call__
    return self._function( *tmp, **self._kwargs )
  File
"/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line
339, in _thread
    dn = module.create( properties, container = options.get( 'container' ), superordinate
= options.get( 'superordinate' ) )
  File
"/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line
155, in wrapper_func
    ret = func( *args, **kwargs )
  File
"/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line
353, in create
    raise UDM_Error( get_exception_msg(e), obj.dn )
  File
"/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line
78, in get_exception_msg
    msg += ' ' + arg

TypeError: cannot concatenate 'str' and 'objectExists' objects

Remark:
Ubuntu Desktop als Maschine geadded (Versucht)

The function also exists in UCS@school (copied, see Bug #30088).

See also Bug #30089.
Comment 1 Florian Best univentionstaff 2014-11-28 23:27:55 CET
Created attachment 6484 [details]
patch for one problem

The first problem is that the exception is raised wrong. First argument should be string.
Comment 2 Florian Best univentionstaff 2014-11-29 00:08:30 CET
Created attachment 6485 [details]
patch for all 4 problems

patch which fixes:
* move get_exception_msg into base.__str__
* make base.__str__ error prone
* remove the usage of get_exception_msg in UDM
* remove the usage of get_exception_msg in UCS@school
Comment 3 Florian Best univentionstaff 2014-12-04 00:15:43 CET
The function (which is now located in univention.admin.uexceptions.base.__str__()) cannot raise any exception anymore. It uses string interpolation for the argument and convert unicode to bytestrings.

Fix: svn r56399
Package: univention-directory-manager-modules (10.0.29-5)
YAML: 2014-11-28-univention-directory-manager-modules.yaml
Downgradeable to UCS 3.2-4: possible
Reproducing:
>>> from univention.admin.uexceptions import base
>>> str(base(1,2,3))
>>> from univention.management.console.modules.udm.udm_ldap import get_exception_msg
>>> get_exception_msg(base(1,2,3))
Comment 4 Dirk Wiesenthal univentionstaff 2015-01-08 01:26:52 CET
OK, function removed, no problems encountered. The function was somewhat public (in that it did not start with _), but I guess this is okay.
Comment 5 Janek Walkenhorst univentionstaff 2015-01-08 13:59:36 CET
http://errata.univention.de/ucs/4.0/18.html
Comment 6 Florian Best univentionstaff 2015-01-26 10:19:16 CET
Reported again, 3.2-4 errata277 (Borgfeld).
Remark:
Anlegen eines IP-Managed-Cleints