Univention Bugzilla – Bug 52746
KeyError: 'ucsschoolRole' in schoolrooms/computer
Last modified: 2023-10-23 11:15:26 CEST
Problem occurs again in customer environment. Customer has IP Devices, MAC and windows computer. Some of them, however created maybe very old objects, don't have a ucsschoolRole. The searchfilter of the module should be rugged enough to handle such computer objects. Interner Server-Fehler in "schoolrooms/computers". Request: schoolrooms/computers Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 359, in __error_handling six.reraise(etype, exc, etraceback) File "/usr/lib/python2.7/dist-packages/univention/management/console/base.py", line 262, in execute function.__func__(self, request, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/univention/management/console/modules/decorators.py", line 181, in _response return function(self, request) File "/usr/lib/pymodules/python2.7/ucsschool/lib/school_umc_ldap_connection.py", line 140, in wrapper_func return func(*args, **kwargs) File "/usr/lib/pymodules/python2.7/univention/management/console/modules/schoolrooms/__init__.py", line 67, 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 869, 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 375, 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 945, 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 375, 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 954, in from_udm_obj udm_value = udm_obj[attr.udm_name] File "/usr/lib/python2.7/dist-packages/univention/admin/handlers/__init__.py", line 478, in __getitem__ elif key not in self.__no_default and self.descriptions[key].editable: KeyError: 'ucsschoolRole' ################################################################################################### +++ This bug was initially created as a clone of Bug #49311 +++ 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?!
At previous bugs Bug 49311 and Bug 50349 a script was developed to fix these issues - does this help? /usr/share/ucs-school-import/scripts/fix_ucsschool_roles --dry-run Please also provide the ldapsearch output of an affected computerobject
The script throws a traceback. You can find requested detailed information in the ticket: https://otrs.knut.univention.de/otrs/index.pl?Action=AgentTicketZoom;TicketID=1061646;ArticleID=2264828#
There are errors in the LDAP data of computer objects. But there is also an error in the fix_ucsschool_roles script. I have requested further LDAP dumps to both a) reproduce the problem in fix_ucsschool_roles and b) check for more inconsistent LDAP objects.
How do we go on in this case. The object was deleted; correct. But Daniel wrote there is a error in the script fix_ucsschool_roles. Do you need further information to solve this?
reported again: Ticket: 2021061021000267 Version: 4.4-8 errata992 (Blumenthal) - UCS@school 4.4 v9
Version: 4.4-7 errata910 (Blumenthal) - UCS@school 4.4 v8 Error: 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 359, in __error_handling six.reraise(etype, exc, etraceback) File "%PY2.7%/univention/management/console/base.py", line 262, in execute function.__func__(self, request, *args, **kwargs) File "%PY2.7%/univention/management/console/modules/decorators.py", line 181, in _response return function(self, request) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 246, in _decorated ret = func(self, request, *a, **kw) File "%PY2.7%/ucsschool/lib/school_umc_ldap_connection.py", line 146, in wrapper_func return func(*args, **kwargs) File "%PY2.7%/univention/management/console/modules/schoolwizards/__init__.py", line 520, 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 447, 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 890, in get_all ret.append(cls.from_udm_obj(udm_obj, school, lo)) File "%PY2.7%/ucsschool/lib/models/computer.py", line 380, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/base.py", line 967, in from_udm_obj return klass.from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/computer.py", line 380, in from_udm_obj obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo) File "%PY2.7%/ucsschool/lib/models/base.py", line 977, in from_udm_obj udm_value = udm_obj[attr.udm_name] File "%PY2.7%/univention/admin/handlers/__init__.py", line 478, in __getitem__ elif key not in self.__no_default and self.descriptions[key].editable: KeyError: 'ucsschoolRole' Role: domaincontroller_master
We couldn't reproduce this bug. Also the latest traceback is from more than half a year ago.
Please create (or clone) a new bug for UCS 5.0 if it happens again.
See https://forge.univention.org/bugzilla/show_bug.cgi?id=55500.
*** Bug 55500 has been marked as a duplicate of this bug. ***
*** Bug 51883 has been marked as a duplicate of this bug. ***