Bug 34680 - Traceback when UDM module is None (UDM_Error: 'NoneType' object has no attribute 'object')
Traceback when UDM module is None (UDM_Error: 'NoneType' object has no attrib...
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
:
: 26966 29201 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-04-29 11:21 CEST by Dirk Wiesenthal
Modified: 2015-03-17 15:07 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): Error handling, External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Wiesenthal univentionstaff 2014-04-29 11:21:30 CEST
Masked traceback feedback (see Bug #32979).

I guess self.module is None, but I could be mistaken:

obj = self.module.object( None, ldap_connection, None, ldap_dn, superordinate, attributes = attributes )

 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
879, in _thread
    return read_syntax_choices( request.options[ 'syntax' ], request.options )
  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
1322, in read_syntax_choices
    obj = module.get( dn )
  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
475, in get
    raise UDM_Error( get_exception_msg( e ) )

UDM_Error: 'NoneType' object has no attribute 'object'


 Remark:
Im UMC - nach Update von UCS 3.1 auf 3,2 - Benutzerverwaltung - bestehenden
Benutzereintrag zum Editieren öffnen => Interner Modulfehler ...



Version:
3.2-1 errata88 (Borgfeld)
Comment 1 Florian Best univentionstaff 2014-07-07 11:05:18 CEST
reported again, 3.2-1 errata111 (Borgfeld).
Comment 2 Florian Best univentionstaff 2014-09-15 09:07:13 CEST
Also reported with 3.2-3 errata185 (Borgfeld).
Comment 3 Florian Best univentionstaff 2014-09-22 10:22:26 CEST
Remark:
Aufrufen eines Users

Version:
3.2-3 errata206 (Borgfeld)
Comment 4 Alexander Kläser univentionstaff 2014-09-24 15:12:48 CEST
@Drees: Might this be related to Bug 29231 and Bug 34246?
Comment 5 Florian Best univentionstaff 2015-01-05 14:10:31 CET
svn r57078:
Bug #34680: Fix errors when no module for specific ldap objects exists.
    
Multiple checks contained these errors:
Lines like the following were used often:
"module = UDM_Module(udm_module); if module is None:"
These could never be true, the correct check is "if module.module is None".
    
The ModuleCache.get() method was wrong, it saved 'None' internally in some cases. A reload of modules then had no effect.
    
get_module() returned UDM_Module() instances even if the handler module for them does not exists.
Comment 6 Dirk Wiesenthal univentionstaff 2015-01-07 03:16:47 CET
(In reply to Florian Best from comment #5)
> Lines like the following were used often:
> "module = UDM_Module(udm_module); if module is None:"
> These could never be true, the correct check is "if module.module is None".

Please also consider "if module not None". Maybe implement __nonzero__ in class UDM_Module? module.module seems... awkward. Note that there is also a lot of:
module = get_module(flavor, superordinate)
if not module:



MODULE.error('Idenfified module %s for %s (flavor=%s) does not have a relating UDM module.' % (ldap_dn, flavor, modules[0]))

s/Idenfified/Identified/ - and I guess the argument ordering is wrong?




Your change in def move is error prone (although probably without any consequences):
if 'container' not in options:
  yield {'$dn$': object, 'success': False, 'details': _('The destination is missing')}
module = get_module(None, object)
if not module: # <----- BTW another faulty test
  yield {'$dn$': object, 'success': False, 'details': _('Could not identify the given LDAP object')}

... can yield twice in one for-iteration - if 'container' not in options.
Comment 7 Florian Best univentionstaff 2015-01-07 11:28:44 CET
(In reply to Dirk Wiesenthal from comment #6)
> (In reply to Florian Best from comment #5)
> > Lines like the following were used often:
> > "module = UDM_Module(udm_module); if module is None:"
> > These could never be true, the correct check is "if module.module is None".
> 
> Please also consider "if module not None". Maybe implement __nonzero__ in
> class UDM_Module? module.module seems... awkward. Note that there is also a
> lot of:
> module = get_module(flavor, superordinate)
> if not module:
This is correct! get_module() will never return a module if module.module does not exists. Note that there were 2 different get_module functions: get_module() and self.get_module()(not anymore)/self.get_module_by_request().

> MODULE.error('Idenfified module %s for %s (flavor=%s) does not have a
> relating UDM module.' % (ldap_dn, flavor, modules[0]))
> 
> s/Idenfified/Identified/ - and I guess the argument ordering is wrong?
yes, both has been fixed.

> Your change in def move is error prone (although probably without any
> consequences):
> if 'container' not in options:
>   yield {'$dn$': object, 'success': False, 'details': _('The destination is
> missing')}
> module = get_module(None, object)
> if not module: # <----- BTW another faulty test
→ not faulty, see the first comment.
>   yield {'$dn$': object, 'success': False, 'details': _('Could not identify
> the given LDAP object')}
> 
> ... can yield twice in one for-iteration - if 'container' not in options.
yes, the 'continue' statement was missing.
Comment 8 Dirk Wiesenthal univentionstaff 2015-01-08 02:42:37 CET
OK, the traceback is gone
Comment 9 Janek Walkenhorst univentionstaff 2015-01-08 14:00:17 CET
http://errata.univention.de/ucs/4.0/18.html
Comment 10 Florian Best univentionstaff 2015-02-16 12:36:32 CET
*** Bug 26966 has been marked as a duplicate of this bug. ***
Comment 11 Florian Best univentionstaff 2015-03-17 15:07:40 CET
*** Bug 29201 has been marked as a duplicate of this bug. ***