Univention Bugzilla – Bug 51545
make schema-checking code more robust
Last modified: 2020-07-30 13:14:48 CEST
A traceback occurred because of an unexpected entry: [..] File "/usr/share/ucs-school-import/checks/defaults.py", line 132, in iterate_config if scheme_field.count("<") != scheme_field.count(">"): AttributeError: 'bool' object has no attribute 'count' The problem was the unexpected key "scheme:username:allow_rename". Make the "check_scheme" test function in the "defaults" check hook more robust.
More robust code was added - untested! Tests should be written to verify it. [dtroeder/51545_schema_check a0cda8d51] Bug #51545: make schema-checking code more robust (WIP)
QA - Code -> looks good, few changes required (+) Functionality ***** I ran some manual tests and implemented a new ucs-test (see below) in [dtroeder/51545_schema_check] ed39da0ec Bug #51545: Add test defaults.py is missing username:scheme:default (+): File "/usr/share/ucs-school-import/checks/defaults.py", line 199, in test_scheme_valid_format "Unknown configuration key 'scheme:username:{}'.".format(k) InitialisationError: Unknown configuration key 'scheme:username:default'. I got the following expected errors: adding scheme:username:allow_rename -> InitialisationError: Deprecated configuration key 'scheme:username:allow_rename'. setting scheme:username to "<:umlauts><firstname>.<lastname><:lower>[COUNTER2]" -> InitialisationError: Value of 'scheme:username' must be a dict/object. setting scheme.firstname to {"default" :...} InitialisationError: Value of 'scheme:firstname' must be a string. setting scheme:username:username to an int InitialisationError: Value of 'scheme:username:username' must be a string. -> mini-mistake: use k instead of name (+) setting scheme:record_uid to an int InitialisationError: Value of 'scheme:record_uid' must be a string. ucs-test ***** Check if no import error is raised for: - scheme:username: "default"** | "staff" | "student" | "teacher", "teacher_and_staff" -scheme: "email" | "firstname" | "lastname" | "description" | "displayName" | "employeeNumber" Check if import error is raised for - scheme:username:allow_rename (depr.) - scheme:username is not allowed - scheme: "email" | "firstname" | "lastname" | "description" | "displayName" | "employeeNumber" and ":default" - scheme:record_uid - scheme:username:defaut: 123 | tuple, list ** This test fails because defaults.py is missing username:scheme:default
Thanks for hints, errors were fixed. I modified the test to not hide exceptions. [4.4] f2b866a70 Bug #51545: make schema-checking code more robust (WIP) [4.4] 632e36694 Bug #51545: Add test [4.4] 7a846a081 Bug #51545: Merge branch 'dtroeder/51545_schema_check' into 4.4 [4.4] 0b58d27ce Bug #51545: changelogs, advisory [4.4] 0d2dd5143 Bug #51545: advisory update ucs-school-import (17.0.37) ucs-test-ucsschool (6.0.119)
QA -> all ok -> VERIFY Code -> ok Changelog -> ok Yaml -> ok No merge conflicts -> ok test are still passing -> ok
Is there a workaround, so the customer can import his teachers?
Happened again.
I now set the blocking affect. Everytime this traceback occurs the customer cannot import anymore. And this causes a support ticket.
UCS@school 4.4 v5 has been released (errata update to the release). http://docs.software-univention.de/changelog-ucsschool-4.4v5-de.html#changelog:ucsschool:2020-07-30 If this error occurs again, please clone this bug.