Univention Bugzilla – Bug 37945
90_ucsschool.106_valid_hostname.test fails on s4-only-master
Last modified: 2015-03-16 09:41:26 CET
90_ucsschool.106_valid_hostname.test failed on s4-only-master multiple times: http://jenkins.knut.univention.de:8080/job/UCSschool%204.0/job/UCSschool%204.0%20Multiserver/22/SambaVersion=s4-only-master/testReport/90_ucsschool/106_valid_hostname/test/ http://jenkins.knut.univention.de:8080/job/UCSschool%204.0/job/UCSschool%204.0%20Multiserver/21/SambaVersion=s4-only-master/testReport/90_ucsschool/106_valid_hostname/test/ http://jenkins.knut.univention.de:8080/job/UCSschool%204.0/job/UCSschool%204.0%20Multiserver/20/SambaVersion=s4-only-master/testReport/90_ucsschool/106_valid_hostname/test/ http://jenkins.knut.univention.de:8080/job/UCSschool%204.0/job/UCSschool%204.0%20Multiserver/19/SambaVersion=s4-only-master/testReport/90_ucsschool/106_valid_hostname/test/ This script is disabled for now. Please enable it when this bug is fixed.
From the log file: ---[cut]--- Usage: create_ou [options] <ou_name> [<educational_dc_name> [<administrative_dc_name>]] create school container for UCS@school Arguments: <ou_name> name of ou that shall be created or verified <educational_dc_name> hostname of the educational DC for specified OU (if dc_name is not specified "dc<ou_name>-01" will be used as the default for the domaincontroller name) <administrative_dc_name> hostname of the administrative DC for the specified OU create_ou: error: no such option: -b ---[cut]--- There were also the errors: create_ou: error: no such option: -e and create_ou: error: no such option: -n It looks like the OU name, the given edu_dc_name or the admin_dc_name starts incorrectly with a dash character.
(In reply to Sönke Schwardt-Krummrich from comment #1) > It looks like the OU name, the given edu_dc_name or the admin_dc_name starts > incorrectly with a dash character. The test script includes testing such cases, where they should fail. The bug here is that it was possible to create a school with a dc_name containing an underscore in the middle, e.g: ### FAIL ### Creating a school(jnjvcugq9h) cli with dc_name=yf1z_brk was unexpectedly successful ### ###
In /usr/share/ucs-school-import/scripts/create_ou line 151 function is_valid_ou_name: def is_valid_hostname(name): """ check if given hostname is valid """ return bool(re.match('^[a-zA-Z0-9](([a-zA-Z0-9-_]*)([a-zA-Z0-9]$))?$', name)) This includes the "_" in the middle of a host name to be valid, while it is not. Removing the "_" from the regex make the test script pass.
Please add an exception for the CLI variant of create_ou in the test script. The CLI variant does also accept underscores in hostnames for compatibility reasons. The UMC and the python variant do not accept underscores.
(In reply to Sönke Schwardt-Krummrich from comment #4) > Please add an exception for the CLI variant of create_ou in the test script. > The CLI variant does also accept underscores in hostnames for compatibility > reasons. The UMC and the python variant do not accept underscores. Done.