Bug 41847 - ucs-school-import: crash with empty class name in CSV
ucs-school-import: crash with empty class name in CSV
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.1 R2
Other Linux
: P5 critical (vote)
: UCS@school 4.1 R2 vXXX
Assigned To: Daniel Tröder
Sönke Schwardt-Krummrich
: interim-1
Depends on:
Blocks: 42288
  Show dependency treegraph
 
Reported: 2016-07-25 13:46 CEST by Daniel Tröder
Modified: 2016-10-07 16:54 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 7: Crash: Bug causes crash or data loss
Who will be affected by this bug?: 4: Will affect most installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.640
Enterprise Customer affected?:
School Customer affected?: Yes
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 2016-07-25 13:46:58 CEST
An empty class name (except for staff) in a CSV row leads to a bad class name "<school>-" which leads to UDM refusing to create the group →  failed import.
Comment 1 Daniel Tröder univentionstaff 2016-07-25 14:03:32 CEST
Fixed in r71222
Advisory: r71223
Comment 2 Daniel Tröder univentionstaff 2016-07-26 10:59:37 CEST
Another problem with empty class names was fixed.
A ucs-test was added.

Test: 71232
Fix: 71233
Advisory: 71234
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2016-07-26 11:09:36 CEST
For QA:
If no class has been specified, the legacy import should leave the class memberships untouched during a M(odification) action. This should apply for teachers AND students.

Explanation:
Students have to be assigned to at least one class in CSV. If the class is set, modifications are performed.
The assignment of teachers to classes is done via the UMC modules. Therefore if the teacher is modified via legacy import, no class membership is defined in CSV and the import should not alter the class memberships. Otherwise all changes done via UMC are lost.
Comment 4 Daniel Tröder univentionstaff 2016-07-26 12:06:38 CEST
(In reply to Sönke Schwardt-Krummrich from comment #3)
> The assignment of teachers to classes is done via the UMC modules. Therefore
> if the teacher is modified via legacy import, no class membership is defined
> in CSV and the import should not alter the class memberships. Otherwise all
> changes done via UMC are lost.
This is contrary to the concept of "import data represents target state".
* This does probably not work now.
* Are there other cases where import data does NOT represent the target state?
* How to distinguish "no classes → ignore" from a situation where a teacher _should_ be removed from all classes, because it is managed in the dource database? (What is supported?)
Comment 5 Florian Best univentionstaff 2016-07-26 12:13:17 CEST
Maybe:
If the 'class' header line is present and empty in the CSV file the user should be removed from the classes. If it's not present the current classes should be kept.
Comment 6 Daniel Tröder univentionstaff 2016-09-08 12:01:04 CEST
Test for this bug is in 90_ucsschool/34_import-users_via_cli_v2
test_create_with_empty_class_name().
Comment 7 Sönke Schwardt-Krummrich univentionstaff 2016-09-15 17:50:47 CEST
(In reply to Daniel Tröder from comment #6)
> Test for this bug is in 90_ucsschool/34_import-users_via_cli_v2
> test_create_with_empty_class_name().

This only tests the new import. I also added 34_import-users-legacy that checks the legacy import without specified class for students, teachers, teacherAndStaff and staff.

OK: code change
OK: functional test
    - ucs-school-import
    - import-user
OK: test script
OK: advisory

The UMC CSV module is still broken → bug #41987
Comment 8 Sönke Schwardt-Krummrich univentionstaff 2016-10-04 13:24:45 CEST
UCS@school 4.1 R2 v5 has been released.

http://docs.software-univention.de/changelog-ucsschool-4.1R2v5-de.html

If this error occurs again, please clone this bug.
Comment 9 Sönke Schwardt-Krummrich univentionstaff 2016-10-07 16:54:39 CEST
*** Bug 41834 has been marked as a duplicate of this bug. ***