Problem
The UCS@school 911_ucsschool_consistency check fails with the following error:
##################### Start 911_ucsschool_consistency ######################
## Check failed: 911_ucsschool_consistency - UCS@school Consistency Check ##
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/univention/management/console/modules/diagnostic/__init__.py", line 276, in execute
ret = execute(umc_module, **kwargs)
File "/usr/lib/python3/dist-packages/univention/management/console/modules/diagnostic/plugins/911_ucsschool_consistency.py", line 61, in run
res = check_all() # type: Dict[str, Dict[str, List[str]]]
File "/usr/lib/python3/dist-packages/ucsschool/lib/consistency.py", line 563, in check_all
user_issues = user_check.check_user(dn, attrs)
File "/usr/lib/python3/dist-packages/ucsschool/lib/consistency.py", line 283, in check_user
if ou.encode("UTF-8") not in attrs["ucsschoolSchool"]:
KeyError: 'ucsschoolSchool'
###################### End 911_ucsschool_consistency #####################
Root Cause
This occurs because the ucsschoolSchool attribute is missing on one or more user objects during the consistency check.
This attribute is required to validate school membership consistency. The issue is tracked in the following bug report: Bug 58521
Solution
- Identify affected user objects:
Run the following command to find users missing theucsschoolSchoolattribute:
univention-ldapsearch -LLL '(&(objectClass=ucsschoolType)(!(univentionObjectType=groups/group))(!(ucsschoolSchool=*)))' 1.1
- Update user objects:
- For each identified user, ensure they are members of the appropriate school class group.
- Add the
ucsschoolSchoolattribute by assigning the user to the correct school group (e.g., via the Univention Management Console or LDAP tools).
Additional Notes
- You could apply the patch from comment 1 from the bug report:
Comment 1
to the/usr/lib/python3/dist-packages/ucsschool/lib/consistency.pyfile to handle missing attributes gracefully:--- ucs-school-lib/modules/ucsschool/lib/consistency.py +++ ucs-school-lib/modules/ucsschool/lib/consistency.py @@ -274,19 +274,19 @@ class UserCheck(object): for group_dn in users_group_dns: issues += self.check_allowed_membership(group_dn, staff=True) # Check if student is in a class group. if not user_obj.school_classes and user_obj.is_student(self.lo): issues.append("Is not a member of any school class.") # Users should also be member of the corresponding school for ou in user_obj.school_classes: - if ou.encode("UTF-8") not in attrs["ucsschoolSchool"]: + if ou.encode("UTF-8") not in attrs.get("ucsschoolSchool", []): issues.append( "Is member of class {} but school property is not correspondingly set.".format( user_obj.school_classes[ou][0] ) ) - Official Fix: Monitor the bug report for a permanent solution in future UCS@school updates.
- Version Compatibility: This issue affects UCS@school versions prior to the patch release.