Bug 49311 - KeyError: 'ucsschoolRole' in schoolrooms/computer
KeyError: 'ucsschoolRole' in schoolrooms/computer
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: UMC - Computer room administration
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v3-errata
Assigned To: Ole Schwiegert
Daniel Tröder
:
Depends on:
Blocks: 50349 52746
  Show dependency treegraph
 
Reported: 2019-04-17 15:11 CEST by Florian Best
Modified: 2021-02-05 12:41 CET (History)
8 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.206
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2019042521000318, 2019042921000696, 2019041721000477, 2019081621000542, 2019101821000267, 2019081621000542, 2019080921000771, 2019070121000331, 2020070121000122
Bug group (optional):
Max CVSS v3 score:


Attachments
patch (931 bytes, patch)
2019-04-23 12:01 CEST, Christina Scheinig
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2019-04-17 15:11:23 CEST
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?!
Comment 1 Christina Scheinig univentionstaff 2019-04-18 15:12:25 CEST
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.
Comment 2 Christina Scheinig univentionstaff 2019-04-23 12:01:26 CEST
Created attachment 9987 [details]
patch

The patch is for a school slave and patches
/usr/share/pyshared/ucsschool/lib/models/computer.py
Comment 3 Johannes Keiser univentionstaff 2019-05-14 15:30:43 CEST
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'
Comment 4 Johannes Keiser univentionstaff 2019-05-14 16:13:29 CEST
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'
Comment 5 Johannes Kenkel univentionstaff 2019-08-19 11:35:22 CEST
Happened again see: Ticket#2019081621000542
Comment 6 Ole Schwiegert univentionstaff 2019-09-02 11:31:35 CEST
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.
Comment 7 Daniel Tröder univentionstaff 2019-09-03 16:00:27 CEST
Everything looks good.
Please merge.
Please replace in the test 402_ucsschool_lib_computers "SchoolComputer.lookup()" with "SchoolComputer.get_all()".
Comment 8 Ole Schwiegert univentionstaff 2019-09-04 12:22:27 CEST
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
Comment 9 Daniel Tröder univentionstaff 2019-09-05 10:03:48 CEST
OK: Jenkins tests succeeded on all roles.
OK: advisory
Comment 10 Johannes Kenkel univentionstaff 2019-09-06 10:20:03 CEST
Two more clients are affected (1727 & 108644).
Comment 11 Sönke Schwardt-Krummrich univentionstaff 2019-09-11 14:24:52 CEST
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.
Comment 12 Christian Castens univentionstaff 2020-08-07 13:06:14 CEST
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
Comment 13 Christian Castens univentionstaff 2020-08-07 13:09:15 CEST
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
Comment 14 Christian Castens univentionstaff 2020-08-07 13:10:44 CEST
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
Comment 15 Christian Castens univentionstaff 2020-08-07 13:11:58 CEST
reported again:

Traceback(4621f3f8206253622bb4b653a5f856ab):
Interner Server-Fehler in "schoolwizards/computers/query (schoolwizards/computers)".
Request: schoolwizards/computers/query (schoolwizards/computers)


Role: domaincontroller_master
Comment 16 Christian Castens univentionstaff 2020-08-07 17:53:42 CEST
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