Bug 55500 - schoolwizards/computers/query (schoolwizards/computers): KeyError: 'ucsschoolRole
Summary: schoolwizards/computers/query (schoolwizards/computers): KeyError: 'ucsschool...
Status: CLOSED DUPLICATE of bug 52746
Alias: None
Product: UCS@school
Classification: Unclassified
Component: UMC - Wizards
Version: UCS@school 5.0
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: UCS@school maintainers
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-12-16 15:32 CET by Dirk Ahrnke
Modified: 2023-10-23 11:15 CEST (History)
4 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: 2023020121000448
Bug group (optional): Error handling, External feedback
Customer ID: 09711
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Ahrnke univentionstaff 2022-12-16 15:32:10 CET
UCS Version: 5.0-2 errata508

Internal server error during "schoolwizards/computers/query (schoolwizards/computers)".
KeyError: 'ucsschoolRole'
elif key not in self.__no_default and self.descriptions[key].editable:
File "/usr/lib/python3/dist-packages/univention/admin/handlers/__init__.py", line 478, in __getitem__
udm_value = udm_obj[attr.udm_name]
File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 1025, in from_udm_obj
obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo)
File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 421, in from_udm_obj
return klass.from_udm_obj(udm_obj, school, lo)
File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 1015, in from_udm_obj
obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo)
File "/usr/lib/python3/dist-packages/ucsschool/lib/models/computer.py", line 421, in from_udm_obj
ret.append(cls.from_udm_obj(udm_obj, school, lo))
File "/usr/lib/python3/dist-packages/ucsschool/lib/models/base.py", line 938, in get_all
school_prefix=school_prefix,
File "/usr/lib/python3/dist-packages/univention/management/console/modules/schoolwizards/__init__.py", line 458, in _get_all
computer_class, school, request.options.get("filter"), ldap_user_read, school_prefix=False
File "/usr/lib/python3/dist-packages/univention/management/console/modules/schoolwizards/__init__.py", line 555, in get_computers
return func(*args, **kwargs)
File "/usr/lib/python3/dist-packages/ucsschool/lib/school_umc_ldap_connection.py", line 156, in wrapper_func
ret = func(self, request, *a, **kw)
File "/usr/lib/python3/dist-packages/univention/management/console/modules/schoolwizards/__init__.py", line 241, in _decorated
return function(self, request)
File "/usr/lib/python3/dist-packages/univention/management/console/modules/decorators.py", line 184, in _response
function.__func__(self, request, *args, **kwargs)
File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 250, in execute
raise value
File "/usr/lib/python3/dist-packages/six.py", line 693, in reraise
six.reraise(etype, exc, etraceback)
File "/usr/lib/python3/dist-packages/univention/management/console/base.py", line 347, in __error_handling
Traceback (most recent call last):

Request: schoolwizards/computers/query (schoolwizards/computers)
Internal server error during "schoolwizards/computers/query (schoolwizards/computers)".
Comment 1 Dirk Ahrnke univentionstaff 2022-12-16 15:51:53 CET
this may be a new incarnation of the (unresolved) issue described in Bug 52746
at least it was reported by the same customer

Because of https://forge.univention.org/bugzilla/show_bug.cgi?id=52746#c1 I have cleaned up all errors reported by "/usr/share/ucs-school-import/scripts/fix_ucsschool_roles --dry-run" 
There have been some obviuosly wrong duplicate role-assigments which are removed now. 

Unfortunately it is hard to say from the traceback which object is causing the problem. some candidates (possibly incomplete)

objectClass=ucsschoolComputer:
ucsschoolrole: "ip_computer:school:-"
ucsschoolrole: "ubuntu_computer:school:(redacted_existingschool)"

objectClass=ucsschoolServer
62 systems without any ucsschoolrole
Comment 2 Carlos García-Mauriño univentionstaff 2023-01-05 13:02:12 CET
Some ideas:

```
univention-ldapsearch "(&(objectClass=ucsschoolComputer)(!(ucsschoolRole=*)))"
univention-ldapsearch "(&(objectClass=ucsschoolServer)(!(ucsschoolRole=*)))"
```

Those school computers look good. Even if the ucsschoolrole were wrong, the traceback mentions a KeyError, so we are looking for objects without the ucsschoolrole attribute at all.

The 62 ucsschoolServer without any ucsschoolRole do look suspicious...
Comment 3 Dirk Ahrnke univentionstaff 2023-01-05 14:45:33 CET
There are no systems matching "(&(objectClass=ucsschoolComputer)(!(ucsschoolRole=*)))" anymore, 

univention-ldapsearch "(&(objectClass=ucsschoolServer)(!(ucsschoolRole=*)))" is matching to some memberservers in schools (mostly OPSI-servers).

The error appears when selecting Schools:all and Computers:All as well as with *some* schools and Computers:All. 

Fixing ucsschoolRole for one affected school did unfortunately not solve the problem for this school. On the other side there is one memberserver without ucsschoolrole in a scholl where the error doesnt appear.

Sidenote for completeness: There are some Ubuntu-Computers in Schools but it there is no indication that this is a problem in general. Ubuntu-Computers may be shown with the filter "Computers:All" at least in schools where the error is absent.
Comment 5 Mika Westphal univentionstaff 2023-02-03 11:17:17 CET
Version: 5.0-2 errata556 - UCS@school 5.0 v3

Error:
Interner Server-Fehler in "schoolwizards/computers/query (schoolwizards/computers)".
Request: schoolwizards/computers/query (schoolwizards/computers)

Traceback (most recent call last):
  File "%PY3%/univention/management/console/base.py", line 347, in __error_handling
    six.reraise(etype, exc, etraceback)
  File "%PY3%/six.py", line 693, in reraise
    raise value
  File "%PY3%/univention/management/console/base.py", line 250, in execute
    function.__func__(self, request, *args, **kwargs)
  File "%PY3%/univention/management/console/modules/decorators.py", line 184, in _response
    return function(self, request)
  File "%PY3%/univention/management/console/modules/schoolwizards/__init__.py", line 241, in _decorated
    ret = func(self, request, *a, **kw)
  File "%PY3%/ucsschool/lib/school_umc_ldap_connection.py", line 156, in wrapper_func
    return func(*args, **kwargs)
  File "%PY3%/univention/management/console/modules/schoolwizards/__init__.py", line 555, in get_computers
    computer_class, school, request.options.get("filter"), ldap_user_read, school_prefix=False
  File "%PY3%/univention/management/console/modules/schoolwizards/__init__.py", line 458, in _get_all
    school_prefix=school_prefix,
  File "%PY3%/ucsschool/lib/models/base.py", line 938, in get_all
    ret.append(cls.from_udm_obj(udm_obj, school, lo))
  File "%PY3%/ucsschool/lib/models/computer.py", line 424, in from_udm_obj
    obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo)
  File "%PY3%/ucsschool/lib/models/base.py", line 1015, in from_udm_obj
    return klass.from_udm_obj(udm_obj, school, lo)
  File "%PY3%/ucsschool/lib/models/computer.py", line 424, in from_udm_obj
    obj = super(SchoolComputer, cls).from_udm_obj(udm_obj, school, lo)
  File "%PY3%/ucsschool/lib/models/base.py", line 1025, in from_udm_obj
    udm_value = udm_obj[attr.udm_name]
  File "%PY3%/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
Comment 6 Jan-Luca Kiok univentionstaff 2023-02-13 11:59:22 CET
@Dirk I understood that this seems to be the same as https://forge.univention.org/bugzilla/show_bug.cgi?id=52746 but it does not happen always. Is this blocking you or do you have a workaround?
Comment 9 Carlos García-Mauriño univentionstaff 2023-02-21 12:51:10 CET
To fix this, run `/usr/share/ucs-school-import/scripts/fix_ucsschool_slaves`. The root of this bug appears to be fixed (https://forge.univention.org/bugzilla/show_bug.cgi?id=50280) so it should not happen again after running the mentioned script.
Comment 10 Jan-Luca Kiok univentionstaff 2023-10-23 11:15:20 CEST

*** This bug has been marked as a duplicate of bug 52746 ***