Bug 53874 - ValueError: Missing school prefix in name
ValueError: Missing school prefix in name
Status: RESOLVED INVALID
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.4
Other Linux
: P5 normal (vote)
: ---
Assigned To: UCS@school maintainers
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2021-10-05 10:58 CEST by Christian Castens
Modified: 2022-02-07 08:44 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.171
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number: 2021092721000266, 2022020121000521
Bug group (optional): Error handling, External feedback
Max CVSS v3 score:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Castens univentionstaff 2021-10-05 10:58:57 CEST
Version: 4.4-8 errata1036 (Blumenthal) - UCS@school 4.4 v9

Error:
Interner Server-Fehler in "schoolgroups/put (teacher)".
Request: schoolgroups/put (teacher)

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%/ucsschool/lib/school_umc_ldap_connection.py", line 145, in wrapper_func
    return func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/schoolgroups/__init__.py", line 222, in put
    return self.add_teacher_to_classes(request)
  File "%PY2.7%/univention/management/console/modules/decorators.py", line 181, in _response
    return function(self, request)
  File "%PY2.7%/ucsschool/lib/school_umc_ldap_connection.py", line 145, in wrapper_func
    return func(*args, **kwargs)
  File "%PY2.7%/univention/management/console/modules/schoolgroups/__init__.py", line 435, in add_teacher_to_classes
    if not class_.modify(ldap_machine_write):
  File "%PY2.7%/ucsschool/lib/models/base.py", line 674, in modify
    success = self.modify_without_hooks(lo, validate, move_if_necessary)
  File "%PY2.7%/ucsschool/lib/models/group.py", line 267, in modify_without_hooks
    success = super(SchoolClass, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "%PY2.7%/ucsschool/lib/models/base.py", line 689, in modify_without_hooks
    self.validate(lo, validate_unlikely_changes=True)
  File "%PY2.7%/ucsschool/lib/models/group.py", line 323, in validate
    raise ValueError("Missing school prefix in name: {!r}.".format(self))
ValueError: Missing school prefix in name: SchoolClass(name='******', school='*****', dn=u'cn=*****,cn=klassen,cn=schueler,cn=groups,ou=******,dc=******,dc=lan').

Role: domaincontroller_master
Comment 1 Christina Scheinig univentionstaff 2022-02-02 13:18:52 CET
To make this Traceback more meaningful

Missing school prefix in name: SchoolClass(name='sun-AVT6_21', school='SUN', dn='cn=sun-AVT6_21,cn=klassen,cn=schueler,cn=groups,ou=SUN,dc=schein,dc=me').
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/ucsschool/importer/mass_import/mass_import.py", line 125, in import_users
    user_import.create_and_modify_users(imported_users)  # 90% - 100%
  File "/usr/lib/python2.7/dist-packages/ucsschool/importer/mass_import/user_import.py", line 225, in create_and_modify_users
    success = user.modify(lo=self.connection)
  File "/usr/lib/python2.7/dist-packages/ucsschool/importer/models/import_user.py", line 1088, in modify
    res = super(ImportUser, self).modify(lo, validate, move_if_necessary)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/base.py", line 674, in modify
    success = self.modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/python2.7/dist-packages/ucsschool/importer/models/import_user.py", line 1124, in modify_without_hooks
    return super(ImportUser, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/base.py", line 701, in modify_without_hooks
    self.do_modify(udm_obj, lo)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/user.py", line 310, in do_modify
    if not self.remove_from_school(removed_school, lo):
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/user.py", line 504, in remove_from_school
    self.remove_from_groups_of_school(school, lo)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/user.py", line 519, in remove_from_groups_of_school
    group.modify(lo)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/base.py", line 674, in modify
    success = self.modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/group.py", line 267, in modify_without_hooks
    success = super(SchoolClass, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/base.py", line 689, in modify_without_hooks
    self.validate(lo, validate_unlikely_changes=True)
  File "/usr/lib/python2.7/dist-packages/ucsschool/lib/models/group.py", line 323, in validate
    raise ValueError("Missing school prefix in name: {!r}.".format(self))
ValueError: Missing school prefix in name: SchoolClass(name='sun-AVT6_21', school='SUN', dn='cn=sun-AVT6_21,cn=klassen,cn=schueler,cn=groups,ou=SUN,dc=schein,dc=me').

This traceback occurs during import. One school was accidental named with capitals. Now it seems, that this causes trouble, because the class prefix is lower case. 
The customer gave us the following information:
The csv import file contains students from two schools. Students from the first school (moon) just have their school, but the students from the other site have both schools (moon and SUN), because they write their exams on the first school.

If a student now moves from a class of the second site to a class of the first site, UCS complains that the student cannot be removed from the group of the second site, because the student has only moon in the import file and not as the group from which he should be removed SUN
Comment 2 Daniel Tröder univentionstaff 2022-02-07 08:44:29 CET
The problem is with the inconsistent group name. It must have been manually changed to lower case. The name of all groups in the school "SUN" *must* start with "SUN".
When created by UCS@school, that should have been the case. So I assume it was changed manually.

The school class' DN
'cn=sun-AVT6_21,cn=klassen,cn=schueler,cn=groups,ou=SUN,dc=schein,dc=me' should be
'cn=SUN-AVT6_21,cn=klassen,cn=schueler,cn=groups,ou=SUN,dc=schein,dc=me'.

To fix the groups name, probably two renames will be necessary, as the DN comparisons are case insensitive:

-----------------------------

udm groups/group modify --dn cn=sun-AVT6_21,cn=klassen,... --set name=sun-AVT6_21-OLD
udm groups/group modify --dn cn=sun-AVT6_21-OLD,cn=klassen,... --set name=SUN-AVT6_21

-----------------------------

If you are sure, that the groups name prefix was created lower case by the system - not manually - please reopen.