Univention Bugzilla – Bug 55125
Fix school name and DC host name validation regression in UCS@school 5.0
Last modified: 2022-08-25 17:27:42 CEST
In UCS@school 5.0 the school library (attributes.py::SchoolName and create_ou.py) do not allow creating school OUs with underscores in the name. But this was allowed in UCS@school 4.4 and there is no technical reason not to. Computer host names must not contain underscores. When the create_ou script or function is used without supplying a DC name, the DC name is calculated from the OU name. If the OU name contains an underscore, the DC name is invalid and the school OU creation is (and should be) aborted. But when a valid DC name is submitted, a OU name with an underscore should be allowed.
QA: all ok, as discussed already merged - [x] code ok https://git.knut.univention.de/univention/ucsschool/-/merge_requests/144 - [x] manual qa (see below) - [x] changelog / advisory - jenkins -> will check tomorrow Everything tested on primary + backup before: create ou names with underscores with a valid dc name - Weird, but OK: umc does allow the creation of `TEST_1` . also: umc displays that underscores are not allowed - OK cmd-line does not work ``` /usr/share/ucs-school-import/scripts/create_ou TEST_1 testdc Create OU: TEST_1 The following fields reported errors during validation: name: ['Invalid school name'] ``` - OK python code does not work ``` from univention.admin.uldap import getAdminConnection from ucsschool.lib.models.school import School lo, pos = getAdminConnection() school =School(name="test_me") school.educational_servers = ["testdc"] school.create(lo) 560 self.validate(lo) 561 if self.errors: --> 562 raise ValidationError(self.errors.copy()) 563 564 pos = udm_uldap.position(ucr.get("ldap/base")) ValidationError: {'name': ['Invalid school name']} ``` after: - OK umc still does allow the creation of `TEST_6` . also: umc still displays that underscores are not allowed :) - OK cmd-line does work ``` /usr/share/ucs-school-import/scripts/create_ou TEST_5 testdc ``` - OK python code does work ``` from univention.admin.uldap import getAdminConnection from ucsschool.lib.models.school import School lo, pos = getAdminConnection() school =School(name="test_me5") school.educational_servers = ["testdc"] school.create(lo) ... Out[2]: True ```
jenkins is happy -> verify