Bug 49462 - 30_import-create_ou_via_cli fails
30_import-create_ou_via_cli fails
Product: UCS@school
Classification: Unclassified
Component: Jenkins
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v2-errata
Assigned To: Sönke Schwardt-Krummrich
Ole Schwiegert
Depends on:
  Show dependency treegraph
Reported: 2019-05-13 18:16 CEST by Daniel Tröder
Modified: 2021-06-18 23:58 CEST (History)
3 users (show)

See Also:
What kind of report is it?: Development Internal
What type of bug is this?: ---
Who will be affected by this bug?: ---
How will those affected feel about the bug?: ---
User Pain:
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2019-05-13 18:16:01 CEST

(2019-05-13 00:03:09.014749) run-parts: executing /usr/share/ucs-school-import/hooks/ou_create_post.d/k2qpzi9jum /tmp/tmptU_Hrr ou=fs6wgrqmxp,ou=fs,dc=autotest201,dc=local
(2019-05-13 00:03:09.014772) /usr/share/ucs-school-import/hooks/ou_create_post.d/k2qpzi9jum:
(2019-05-13 00:03:09.014791) + cat /tmp/tmptU_Hrr
(2019-05-13 00:03:09.014817) fs6wgrqmxp	dcfs6wgrqmxp-01
(2019-05-13 00:03:09.014839) + test ou=fs6wgrqmxp,ou=fs,dc=autotest201,dc=local = ou=fs6wgrqmxp,ou=fs,dc=autotest201,dc=local
(2019-05-13 00:03:09.014860) + univention-ldapsearch -b ou=fs6wgrqmxp,ou=fs,dc=autotest201,dc=local
(2019-05-13 00:03:09.014907) + egrep ^fs6wgrqmxp$ /tmp/tmptU_Hrr
(2019-05-13 00:03:09.014927) + exit 1
(2019-05-13 00:03:09.014947) run-parts: /usr/share/ucs-school-import/hooks/ou_create_post.d/k2qpzi9jum exited with return code 1
(2019-05-13 00:03:09.014965) 2019-05-13 00:03:09 INFO  create_ou.create_ou:106  OU 'fs6wgrqmxp' created successfully.
(2019-05-13 00:03:09.014984) 2019-05-13 00:03:09 INFO  create_ou.main:127  Created OU: fs6wgrqmxp
(2019-05-13 00:03:46.203755) Traceback (most recent call last):
(2019-05-13 00:03:46.203788)   File "30_import-create_ou_via_cli", line 14, in <module>
(2019-05-13 00:03:46.203808)     eio.import_ou_basics(use_cli_api=True, use_python_api=False)
(2019-05-13 00:03:46.203828)   File "/usr/lib/pymodules/python2.7/univention/testing/ucsschool/importou.py", line 601, in import_ou_basics
(2019-05-13 00:03:46.203876)     use_python_api=use_python_api,
(2019-05-13 00:03:46.203899)   File "/usr/lib/pymodules/python2.7/univention/testing/ucsschool/importou.py", line 310, in create_and_verify_ou
(2019-05-13 00:03:46.203942)     raise PreHookFailed()
(2019-05-13 00:03:46.203965) univention.testing.ucsschool.importou.PreHookFailed

The pre- and post-create-OU hooks created by the test expect to find "^%(ou)s$" in the passed CSV file.
But they find "^%(ou)s\t%(dc)s$" instead, with "$dc" being "dc$ou-01", because "not dc and not singlemaster" makes the create_ou script generate a name for the school server like that.
Comment 1 Daniel Tröder univentionstaff 2019-05-13 18:23:23 CEST
That is correct behavior by the create_ou script. The error is in the test.

[4.4 0f22be8cf] Bug #49462: use "dc$ou-01" when dc-name not set and not on singlemaster

ucs-test-ucsschool (6.0.0-56)
Comment 2 Daniel Tröder univentionstaff 2019-05-14 08:28:26 CEST
In Jenkins (4.4 singleserver) 30_import-create_ou_via_cli succeeds now, but 30_import-create_ou_via_python_api fails now:
Also PreHookFailed, but here it expects "^%(ou)s\t%(dc)s$" and finds "dc$ou-01".
Comment 3 Daniel Tröder univentionstaff 2019-05-15 20:09:24 CEST
Very old code prevented the fallback to the default hostname for school DCs, when unset and not on a singleserver.

[4.4] 0c797d742 Bug #49462: create correct hostname for school dc, when not set and not a singelserver
[4.4] bf4667806 Bug #49462: use context manager, disable default hooks to speed up tests
[4.4] 840fbf632 Bug #49462: advisory

ucs-school-lib (12.1.1-7)
ucs-test-ucsschool (6.0.0-57)
Comment 4 Daniel Tröder univentionstaff 2019-06-25 17:04:18 CEST
tests keep failing
Comment 5 Daniel Tröder univentionstaff 2019-06-25 17:05:59 CEST
Tests fail in Jenkins because they now need > 4 hours.
Comment 6 Sönke Schwardt-Krummrich univentionstaff 2019-07-11 22:03:21 CEST
(In reply to Daniel Tröder from comment #5)
> Tests fail in Jenkins because they now need > 4 hours.

Since the last DevDay verify_ldap_object() makes additional 20 attempts in case of an exception every 10 seconds (20 retries/10 seconds → default settings). 
The ucs-test script was designed so that an exception was expected in some places, which now led to an extremely increased runtime. Additional parameters for verify_ldap_object() reduced the number of additional attempts to 0 to restore the old behavior.

[4.4] 2a2392c00 Bug #49462: adopt libs used by 35_import-computers_via_* and 30_import-create_ou_via_*
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2019-07-11 22:03:36 CEST
Package: ucs-test-ucsschool
Version: 6.0.32A~
Branch: ucs_4.4-0
Scope: ucs-school-4.4
Comment 9 Ole Schwiegert univentionstaff 2019-07-23 11:47:42 CEST
Works now
Comment 10 Jürn Brodersen univentionstaff 2019-07-26 13:56:21 CEST
4.4 v3 released
Comment 11 Florian Best univentionstaff 2021-06-18 23:58:10 CEST
git:6adbb37bf42f29620678f54634a84af927acac30 introduced univention.testing.ucsschool.importou.parametrization_id_base64_decode() which is used as ids= function for pytest.mark.parametrize.
This function is expected to return a string. the actual function returns anything. This breaks with newer pytest versions.

Also the detection of base64 by checking if a string ends with = is not really ideal.