Bug 32084 - AttributeError: 'module' object has no attribute 'lookup_filter'
AttributeError: 'module' object has no attribute 'lookup_filter'
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM (Generic)
UNSTABLE
Other Linux
: P5 normal (vote)
: UCS 3.2
Assigned To: Dirk Wiesenthal
Alexander Kläser
: interim-2
Depends on:
Blocks: 32096
  Show dependency treegraph
 
Reported: 2013-07-25 14:56 CEST by Florian Best
Modified: 2013-11-19 06:42 CET (History)
2 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):
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2013-07-25 14:56:25 CEST
Die Ausführung des Kommandos udm/syntax/choices/info ist fehlgeschlagen:

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/__init__.py", line 204, in execute
    func( request )
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 282, in _response
    result = _multi_response(self, request)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 384, in _response
    for res in function(self, iterator, *nones):
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/decorators.py", line 266, in _fake_func
    yield function(self, *args)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/__init__.py", line 829, in syntax_choices_info
    return info_syntax_choices(syntax)
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 1070, in info_syntax_choices
    size += len( module.search( filter = filter_s, simple=not syn.use_objects ) )
  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 430, in search
    if simple and self.allows_simple_lookup():
  File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 236, in allows_simple_lookup
    return bool(getattr( self.module, 'lookup_filter' ))
AttributeError: 'module' object has no attribute 'lookup_filter'

{"options":{"syntax":"UvmmProfiles"},"flavor":"navigation"}

Happens when opening a UVMM-domain in LDAP directory → Virtual Machine Manager → Information.

It should also be checked if the UVMM-module is incorrect.
Comment 1 Alexander Kläser univentionstaff 2013-07-26 12:34:23 CEST
@Dirk: Has that something to do with your changes in Bug 31560 ?
Comment 2 Dirk Wiesenthal univentionstaff 2013-07-26 13:06:58 CEST
Yes. Last line in the traceback should be

- return bool(getattr( self.module, 'lookup_filter' ))
+ return hasattr( self.module, 'lookup_filter' )
Comment 3 Alexander Kläser univentionstaff 2013-07-26 13:27:25 CEST
(In reply to Dirk Wiesenthal from comment #2)
> Yes. Last line in the traceback should be
> 
> - return bool(getattr( self.module, 'lookup_filter' ))
> + return hasattr( self.module, 'lookup_filter' )

What about the erratum? Does this prevent 3.1-1 from working correctly with UVMM?
Comment 4 Florian Best univentionstaff 2013-07-26 13:40:25 CEST
(In reply to Dirk Wiesenthal from comment #2)
> Yes. Last line in the traceback should be
> 
> - return bool(getattr( self.module, 'lookup_filter' ))
> + return hasattr( self.module, 'lookup_filter' )
(No!?, is lookup_filter a method or maybe None or a bool?)
→ bool(getattr( self.module, 'lookup_filter', None ))

and what is with the function call in the "lookup_filter" method?
Comment 5 Dirk Wiesenthal univentionstaff 2013-07-26 14:18:52 CEST
(In reply to Alexander Kläser from comment #3)
> (In reply to Dirk Wiesenthal from comment #2)
> > Yes. Last line in the traceback should be
> > 
> > - return bool(getattr( self.module, 'lookup_filter' ))
> > + return hasattr( self.module, 'lookup_filter' )
> 
> What about the erratum? Does this prevent 3.1-1 from working correctly with
> UVMM?

Should not require an erratum update, although it is broken.

File "/usr/lib/pymodules/python2.6/univention/management/console/modules/udm/udm_ldap.py", line 236, in allows_simple_lookup
    return bool(getattr( self.module, 'lookup_filter' ))

This was meant to be a second safety net. It is broken. But it is only called when a Syntax says use_objects=False. And in these cases lookup_filter is always present (because it is just a defined set of syntax classes in 3.1-1).

UvmmProfiles do not exist in 3.1-1 and even if they surely would have use_objects=True
Comment 6 Dirk Wiesenthal univentionstaff 2013-07-26 18:12:01 CEST
Fixed in 3.2-0:
  univention-management-console-module-udm 4.0.10-1.330.201307261803
Comment 7 Dirk Wiesenthal univentionstaff 2013-07-26 18:15:07 CEST
(In reply to Florian Best from comment #4)
> and what is with the function call in the "lookup_filter" method?

Will raise. It is a function call on a wrapper with an underlying object lacking that functionality. Returning None would have to handled equally.

Currently lookup_filter() is only used if allows_simple_lookup(). If someone wants to use it somewhere else he has to take care of that himself.
Comment 8 Alexander Kläser univentionstaff 2013-09-20 12:26:33 CEST
The call works now. I called it explicitely via:

> require('umc/tools').umcpCommand('udm/syntax/choices/info', {"syntax":"UvmmProfiles"}, true, 'navigation')

This particular syntax has also been adapted for speed up via Bug 24774.

Changelog → not necessary.
Comment 9 Stefan Gohmann univentionstaff 2013-11-19 06:42:07 CET
UCS 3.2 has been released:
 http://docs.univention.de/release-notes-3.2-en.html
 http://docs.univention.de/release-notes-3.2-de.html

If this error occurs again, please use "Clone This Bug".