Univention Bugzilla – Bug 52783
get_role_info() returns wrong context, add exception hierarchy
Last modified: 2021-02-23 16:15:22 CET
A typo in the get_role_info() function returns the wrong context. Fix it. Additionally add an exception hierarchy, so it's easier to cope with bad role strings.
[4.4 8797f783c] Bug #52783: fix typo in get_role_info(), add exception hierarchy [4.4 7167995bc] Bug #52783: advisory ucs-school-lib (12.2.9) The change was also cherry-picked into the branches feature/kelvin and twenzel/52309_validation.
QA → All OK → REOPEN Code → Looks good, more precise errors, hierarchy makes sense. Changelog → OK Advisory → OK migration to feature/kelvin → OK Jenkins → http://jenkins.knut.univention.de:8080/job/UCSschool-4.4/job/Install%20Singleserver/lastCompletedBuild/Config=s4,TestGroup=import1,UCSRelease=testing/testReport/90_ucsschool/301_http-api_pyclient_roles/master201/ fails since Friday, check if it is related. >>> get_role_info("my:invalid:DEMOSCHOOL:thing") "Invalid UCS@school role string: {!r}.".format(ucsschool_role_string) InvalidUcsschoolRoleString: Invalid UCS@school role string: 'my:invalid:DEMOSCHOOL:thing'. >>> get_role_info("my:invalid:DEMOSCHOOL") "The role string {!r} includes the unknown role {!r}.".format(ucsschool_role_string, role) UnknownRole: The role string 'my:invalid:DEMOSCHOOL' includes the unknown role 'my'. >>> get_role_info("student:invalid:DEMOSCHOOL") ucsschool_role_string, context_type UnknownContextType: The role string 'student:invalid:DEMOSCHOOL' includes the unknown context type 'invalid'. >>> get_role_info("student:school:DEMOSCHOOL") ('student', 'school', 'DEMOSCHOOL') >>> get_role_info("student:exam:DEMOSCHOOL") ('student', 'exam', 'DEMOSCHOOL')
(In reply to Tobias Wenzel from comment #2) > Jenkins → > http://jenkins.knut.univention.de:8080/job/UCSschool-4.4/job/ > Install%20Singleserver/lastCompletedBuild/Config=s4,TestGroup=import1, > UCSRelease=testing/testReport/90_ucsschool/301_http-api_pyclient_roles/ > master201/ fails since Friday, check if it is related. It is unrelated. The problem in 90_ucsschool/301_* to 304_* was that the Import-HTTP-API was not running at all. The reason is explained here: https://forge.univention.org/bugzilla/show_bug.cgi?id=52458#c5
QA -> All OK -> Verify
Errata update for UCS@school 4.4 v8 have been released. https://docs.software-univention.de/changelog-ucsschool-4.4v8-de.html If this error occurs again, please clone this bug.