Univention Bugzilla – Bug 49311
KeyError: 'ucsschoolRole' in schoolrooms/computer
Last modified: 2021-02-05 12:41:17 CET
The schoolroom UMC doesn't initialize all UDM objects causing the following traceback when opening the UMC module: Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/univention/management/console/base.py", line 253, in execute function.__func__(self, request, *args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/decorators.py", line 192, in _response return function(self, request) File "/usr/lib/pymodules/python2.7/ucsschool/lib/schoolldap.py", line 145, in wrapper_func return func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolrooms/__init__.py", line 61, in computers } for x in SchoolComputer.get_all(ldap_user_read, request.options['school'], pattern)] File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 808, in get_all ret.append(cls.from_udm_obj(udm_obj, school, lo)) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/computer.py", line 293, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 859, in from_udm_obj return klass.from_udm_obj(udm_obj, school, lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/computer.py", line 293, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 866, in from_udm_obj udm_value = udm_obj[attr.udm_name] File "/usr/lib/pymodules/python2.7/univention/admin/handlers/__init__.py", line 466, in __getitem__ elif key not in self.__no_default and self.descriptions[key].editable: KeyError: 'ucsschoolRole' Probably the bug is in the UCS@school models lib: get_class_for_udm() doesn't handle DC Slaves. IMO it should return ShoolDCSlave. This would probably™ cause that the correct UDM initialization is done?!
Maybe a helpful addition: On a school-slave: the computerroom is meant by the following description: in the search pattern at "Add objects" enter the string "test", a computer object named "<ou>-test1" will be displayed correctly. If I enter "<ou>" as the search string, the error message is triggered.
Created attachment 9987 [details] patch The patch is for a school slave and patches /usr/share/pyshared/ucsschool/lib/models/computer.py
Reported again: Version: 4.4-0 errata59 (Blumenthal) - UCS@school 4.4 v2 Interner Server-Fehler in "schoolwizards/computers/query (schoolwizards/computers)". Request: schoolwizards/computers/query (schoolwizards/computers) Traceback (most recent call last): File "%PY2.7%/univention/management/console/base.py", line 253, in execute function.__func__(self, request, *args, **kwargs) File "%PY2.7%/univention/management/console/modules/decorators.py", line 192, in _response return function(self, request) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 122, in _decorated ret = func(self, request, *a, **kw) File "%PY2.7%/ucsschool/lib/schoolldap.py", line 145, in wrapper_func return func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 330, in get_computers return self._get_all(computer_class, school, request.options.get('filter'), ldap_user_read) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 271, in _get_all objs.extend(klass.get_all(lo, school.name, filter_str=filter_str, easy_filter=True)) File "%PY2.7%/ucsschool/lib/models/base.py", line 808, in get_all ret.append(cls.from_udm_obj(udm_obj, school, lo)) File "%PY2.7%/ucsschool/lib/models/computer.py", line 293, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/base.py", line 859, in from_udm_obj return klass.from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/computer.py", line 293, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/base.py", line 866, in from_udm_obj udm_value = udm_obj[attr.udm_name] File "%PY2.7%/univention/admin/handlers/__init__.py", line 466, in __getitem__ elif key not in self.__no_default and self.descriptions[key].editable: KeyError: 'ucsschoolRole'
Reported again: Version: 4.4-0 errata59 (Blumenthal) - UCS@school 4.4 v2 Remark: vor Upgrade auf 4.4-0 - Hinzufügen von WindowsClients/IPManagedClients möglich, Ubuntu-Clients nicht nach Upgrade auf 4.4-0 - kein Hinzufügen mehr möglich Interner Server-Fehler in "schoolrooms/computers". Request: schoolrooms/computers Traceback (most recent call last): File "%PY2.7%/univention/management/console/base.py", line 253, in execute function.__func__(self, request, *args, **kwargs) File "%PY2.7%/univention/management/console/modules/decorators.py", line 192, in _response return function(self, request) File "%PY2.7%/ucsschool/lib/schoolldap.py", line 145, in wrapper_func return func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/schoolrooms/__init__.py", line 61, in computers } for x in SchoolComputer.get_all(ldap_user_read, request.options['school'], pattern)] File "%PY2.7%/ucsschool/lib/models/base.py", line 808, in get_all ret.append(cls.from_udm_obj(udm_obj, school, lo)) File "%PY2.7%/ucsschool/lib/models/computer.py", line 293, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/base.py", line 859, in from_udm_obj return klass.from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/computer.py", line 293, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/base.py", line 866, in from_udm_obj udm_value = udm_obj[attr.udm_name] File "%PY2.7%/univention/admin/handlers/__init__.py", line 466, in __getitem__ elif key not in self.__no_default and self.descriptions[key].editable: KeyError: 'ucsschoolRole'
Happened again see: Ticket#2019081621000542
The core problem here is that SchoolComputer.lookup() delivers all udm computer/* objects that are in the school OU when it should only return client computers. Hence I modified the lookup to only return udm objects that have the objectClass ucsschoolComputer. Implemented in oschwieg/4.4/49311. Please QA and reopen for merge and build. The testcase will be added later today. A new bug will be opened that deals with the wrong objectClasses on the objects mentioned in the attached tickets.
Everything looks good. Please merge. Please replace in the test 402_ucsschool_lib_computers "SchoolComputer.lookup()" with "SchoolComputer.get_all()".
Package: ucs-test-ucsschool Version: 6.0.44A~4.4.0.201909041217 Branch: ucs_4.4-0 Scope: ucs-school-4.4 Package: ucs-school-lib Version: 12.1.7A~4.4.0.201909041215 Branch: ucs_4.4-0 Scope: ucs-school-4.4
OK: Jenkins tests succeeded on all roles. OK: advisory
Two more clients are affected (1727 & 108644).
UCS@school 4.4 v3 has been released. https://docs.software-univention.de/changelog-ucsschool-4.4v3-de.html If this error occurs again, please clone this bug.
reported again Version: 4.4-2 errata298 (Blumenthal) - UCS@school 4.4 v2 Remark: auf Master über Schuladministration auf Kategorie Rechner gecklickt Traceback(4621f3f8206253622bb4b653a5f856ab): Interner Server-Fehler in "schoolwizards/computers/query (schoolwizards/computers)". Request: schoolwizards/computers/query (schoolwizards/computers) Role: domaincontroller_master
reported again Version: 4.4-1 errata223 (Blumenthal) - UCS@school 4.4 v3 Remark: z.H. Herrn Kenkel (Gemeinsam reproduced) Traceback(4621f3f8206253622bb4b653a5f856ab): Internal server error during "schoolwizards/computers/query (schoolwizards/computers)". Request: schoolwizards/computers/query (schoolwizards/computers) Role: domaincontroller_master
reported again Version: 4.4-1 errata223 (Blumenthal) - UCS@school 4.4 v3 Traceback(4621f3f8206253622bb4b653a5f856ab): Interner Server-Fehler in "schoolwizards/computers/query (schoolwizards/computers)". Request: schoolwizards/computers/query (schoolwizards/computers) Role: domaincontroller_master
reported again: Traceback(4621f3f8206253622bb4b653a5f856ab): Interner Server-Fehler in "schoolwizards/computers/query (schoolwizards/computers)". Request: schoolwizards/computers/query (schoolwizards/computers) Role: domaincontroller_master
reported again Version: 4.4-4 errata642 (Blumenthal) - UCS@school 4.4 v5 Error: Interner Server-Fehler in "schoolrooms/computers". Request: schoolrooms/computers Role: domaincontroller_slave