Bug 52783 - get_role_info() returns wrong context, add exception hierarchy
get_role_info() returns wrong context, add exception hierarchy
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Ucsschool-lib
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v8-errata
Assigned To: Daniel Tröder
Tobias Wenzel
:
Depends on:
Blocks: 52309 52784
  Show dependency treegraph
 
Reported: 2021-02-12 11:25 CET by Daniel Tröder
Modified: 2021-02-23 16:15 CET (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Tröder univentionstaff 2021-02-12 11:25:59 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.
Comment 1 Daniel Tröder univentionstaff 2021-02-12 11:47:50 CET
[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.
Comment 2 Tobias Wenzel univentionstaff 2021-02-15 13:06:29 CET
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')
Comment 3 Daniel Tröder univentionstaff 2021-02-15 14:25:14 CET
(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
Comment 4 Tobias Wenzel univentionstaff 2021-02-15 14:36:48 CET
QA -> All OK -> Verify
Comment 5 Tobias Wenzel univentionstaff 2021-02-23 16:15:22 CET
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.