Univention Bugzilla – Bug 54981
KeyError: 'objectType' when opening users/user module with OX connector app installed
Last modified: 2023-07-06 19:01:42 CEST
Version: 5.0-2 errata345 Remark: I have a UCS 5.0-2 primary domain controller with the OX Connector app installed. When I open the UDM user module, I see the traceback. It occurs every time I open the module. Error: Interner Server-Fehler in "udm/syntax/choices (users/user)". Request: udm/syntax/choices (users/user) Traceback (most recent call last): File "%PY3%/notifier/threads.py", line 80, in _run result = self._function() File "%PY3%/notifier/__init__.py", line 105, in __call__ return self._function(*tmp, **self._kwargs) File "%PY3%/univention/management/console/modules/udm/udm_ldap.py", line 99, in _decorated return method(*args, **kwargs) File "%PY3%/univention/management/console/ldap.py", line 152, in _decorated result = func(*args, **kwargs) File "%PY3%/univention/management/console/modules/udm/__init__.py", line 1002, in _thread return read_syntax_choices(syntax, options, ldap_connection=ldap_connection, ldap_position=ldap_position) File "%PY3%/univention/management/console/modules/udm/udm_ldap.py", line 1353, in read_syntax_choices module = UDM_Module(choice['objectType'], ldap_connection=ldap_connection, ldap_position=ldap_position) KeyError: 'objectType' Role: domaincontroller_master
udm settings/syntax list DN: cn=oxContextSelect,cn=open-xchange,cn=custom attributes,cn=univention,dc=ox-conn,dc=intranet addEmptyValue: TRUE base: None description: Select OX context objects filter: objectClass=oxContext ldapattribute: cn ldapvalue: oxContextIDNum name: oxContextSelect value: None viewonly: FALSE Reproducer: curl 'https://Administrator:univention@demo.univention.de/univention/command/udm/syntax/choices' \ -H 'Accept: application/json; q=1.0, text/html; q=0.3; */*; q=0.1' \ -H 'Content-Type: application/json' \ --data-raw '{"options":{"syntax":"LDAP_Search","options":{"syntax":"LDAP_Search","filter":"objectClass=oxContext","viewonly":false,"base":"","value":"oxContextIDNum","attributes":["cn"],"empty":true,"empty_end":false}},"flavor":"users/user"}'
The reason is that LDAPSearch adds an item without the 'objectType' key when addEmptyValue or appendEmptyValue: 5887 » » if cls.addEmptyValue: 5888 » » » choices.insert(0, {'id': '', 'label': ''}) 5889 » » elif cls.appendEmptyValue: 5890 » » » choices.append({'id': '', 'label': ''}) Patch is: diff --git management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py index 34525cee10..be5473d33f 100644 --- management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py +++ management/univention-management-console-module-udm/umc/python/udm/udm_ldap.py @@ -1350,12 +1350,16 @@ def read_syntax_choices(syn, options=None, ldap_connection=None, ldap_position=N if isinstance(syn, udm_syntax.LDAP_Search): choices = [] for choice in syn.get_umc_choices(ldap_connection, options): - module = UDM_Module(choice['objectType'], ldap_connection=ldap_connection, ldap_position=ldap_position) - choice.update({ - 'module': 'udm', - 'flavor': module.flavor, - 'icon': 'udm-%s' % module.name.replace('/', '-'), - }) + try: + module = UDM_Module(choice['objectType'], ldap_connection=ldap_connection, ldap_position=ldap_position) + except KeyError: + pass + else: + choice.update({ + 'module': 'udm', + 'flavor': module.flavor, + 'icon': 'udm-%s' % module.name.replace('/', '-'), + }) choices.append(choice) else: choices = syn.get_choices(ldap_connection, options)
*** Bug 55060 has been marked as a duplicate of this bug. ***
Version: 5.0-2 errata352 Remark: whenever opeing Group Settings
univention-management-console-module-udm.yaml f9dfc722c6e3 | Bug #54981: yaml c634ef88c7ea | Bug #54981: KeyError: 'objectType' when opening users/user module with OX connector app installed univention-management-console-module-udm (10.0.2-3) c634ef88c7ea | Bug #54981: KeyError: 'objectType' when opening users/user module with OX connector app installed
OK: LDAP_Search syntax classes with addEmptyValue or appendEmptyValue work again and add empty values OK: YAML
<https://errata.software-univention.de/#/?erratum=5.0x387>