Bug 46861 - [4.3] Traceback in ucs-school-testuser-import: out of family names?
[4.3] Traceback in ucs-school-testuser-import: out of family names?
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.3
Other Linux
: P5 normal (vote)
: UCS@school 4.3 v3
Assigned To: Sönke Schwardt-Krummrich
Daniel Tröder
:
Depends on: 46857
Blocks: 46924
  Show dependency treegraph
 
Reported: 2018-04-20 16:53 CEST by Sönke Schwardt-Krummrich
Modified: 2018-06-04 15:27 CEST (History)
0 users

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 4: Minor Usability: Impairs usability in secondary scenarios
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.046
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 Sönke Schwardt-Krummrich univentionstaff 2018-04-20 16:53:58 CEST
+++ This bug was initially created as a clone of Bug #46857 +++

root@master110:/usr/share/ucs-school-import/scripts# ./ucs-school-testuser-import --staff 10 --teachers 150 --students 2000 --classes 50 gsmitte
------ Creating user information... ------
Created 50 class names for 1 schools.
------ Writing user information to CSV file 'test_users_2018-03-24_04:41:46.csv'... ------
Created 10 staffs.
Traceback (most recent call last):
  File "./ucs-school-testuser-import", line 121, in <module>
    sys.exit(main())
  File "./ucs-school-testuser-import", line 105, in main
    test_user_exporter.dump(test_user_creator.make_users(), args.csvfile)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/writer/result_exporter.py", line 65, in dump
    for obj in self.get_iter(import_handler):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/utils/test_user_creator.py", line 145, in make_users
    family_name = next(self._get_new_family_name())
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/utils/test_user_creator.py", line 104, in _get_new_family_name
    yield u"{}{}".format(self.test_data["family"][family_cursor], family_modifier)
IndexError: list index out of range
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2018-04-25 15:32:19 CEST
Ported fix from UCS@school 4.2 to 4.3:

ucs-school-import (16.0.1-27)
bad76ba42782 | Bug #46857: fix off by one error
2eb2ba55b079 | Bug #46861: add changelog entry

ucs-school-import.yaml
a02d625d2e27 | Bug #46861: add advisory entry

Hint: mistakenly pushed first commit with comment 
      "Bug #46857: fix off by one error"

Package: ucs-school-import
Version: 16.0.1-27A~4.3.0.201804251526
Branch: ucs_4.3-0
Scope: ucs-school-4.3
Comment 2 Daniel Tröder univentionstaff 2018-04-26 16:33:46 CEST
OK: code change
OK: advisory
OK: manual test:

root@m65:~# dpkg -l ucs-school-import
ii  ucs-school-import        16.0.1-25         all

root@m65:~# python

from ucsschool.importer.utils.test_user_creator import TestUserCreator
test_user_creator = TestUserCreator('SchuleEins', staff=1, students=5, teachers=3, staffteachers=1, classes=1, inclasses=1, schools=1, email=False)
test_user_creator.test_data['given'] = test_user_creator.test_data['given'][:5]
test_user_creator.test_data['family'] = test_user_creator.test_data['family'][:5]
test_user_creator.make_classes()
list(test_user_creator.make_users())

→ IndexError: list index out of range

root@m65:~# univention-upgrade --ignoressh --ignoreterm
root@m65:~# dpkg -l ucs-school-import
ii  ucs-school-import        16.0.1-27A~4.3.0. all

root@m65:~# python

from ucsschool.importer.utils.test_user_creator import TestUserCreator
test_user_creator = TestUserCreator('SchuleEins', staff=1, students=5, teachers=3, staffteachers=1, classes=1, inclasses=1, schools=1, email=False)
test_user_creator.test_data['given'] = test_user_creator.test_data['given'][:5]
test_user_creator.test_data['family'] = test_user_creator.test_data['family'][:5]
test_user_creator.make_classes()
list(test_user_creator.make_users())

→ dict
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2018-05-02 17:59:05 CEST
UCS@school 4.3 v3 has been released.

https://docs.software-univention.de/changelog-ucsschool-4.3v3-de.html

If this error occurs again, please clone this bug.