Bug 49995 - Traceback when moving users to another school if school_classes_keep_if_empty = true
Traceback when moving users to another school if school_classes_keep_if_empty...
Status: CLOSED FIXED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.4 v3-errata
Assigned To: Daniel Tröder
Sönke Schwardt-Krummrich
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-08-11 22:23 CEST by Sönke Schwardt-Krummrich
Modified: 2019-08-14 14:02 CEST (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 5: Blocking further progress on the daily work
User Pain: 0.286
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support: Yes
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 2019-08-11 22:23:48 CEST
A customer set the option "school_classes_keep_if_empty = true" in the CLI config to make sure that the class assignments of teachers are not removed because the customer's CSV file does not contain the school_classes column for teachers.
Unfortunately, the import fails immediately if a teacher is moved to another school:

2019-06-28 18:34:39 INFO  cmdline.prepare_import:132  ------ UCS@school import tool starting ------
2019-06-28 18:34:39 INFO  configuration.read:92  Reading configuration from '/usr/share/ucs-school-import/configs/global_defaults.json'...
2019-06-28 18:34:39 INFO  configuration.read:92  Reading configuration from '/var/lib/ucs-school-import/configs/global.json'...
2019-06-28 18:34:39 INFO  configuration.read:92  Reading configuration from '/usr/share/ucs-school-import/configs/user_import_defaults.json'...
2019-06-28 18:34:39 INFO  configuration.read:92  Reading configuration from '/var/lib/ucs-school-import/configs/user_import.json'...
2019-06-28 18:34:39 INFO  configuration.read:92  Reading configuration from '/tmp/34_import-users_via_cli_v2.xGMtQ2/config.b0rEhM'...
2019-06-28 18:34:39 INFO  configuration._set_username_maxlength:65  UCRV ucsschool/username/max_length: None
2019-06-28 18:34:39 INFO  configuration._set_username_maxlength:73  Set value of configuration key username:max_length:default to default value of UCR variable ucsschool/username/max_length: 20.
2019-06-28 18:34:39 INFO  configuration._set_username_maxlength:82  Set value of configuration key username:max_length:student to username:max_length:default reduced by length of the exam-prefix ('exam-'): 15.
2019-06-28 18:34:39 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'ConfigPyHook' in: /usr/share/ucs-school-import/pyhooks...
2019-06-28 18:34:39 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes:
2019-06-28 18:34:39 INFO  pyhooks_loader.get_hook_objects:163  Loaded hooks: {}.
2019-06-28 18:34:39 INFO  configuration.setup_configuration:58  Finished reading configuration, starting checks...
2019-06-28 18:34:39 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'ConfigurationChecks' in: /usr/share/ucs-school-import/checks...
2019-06-28 18:34:39 INFO  pyhooks_loader.get_hook_classes:124  Hook class 'SingleSourcePartialImportConfigurationChecks' filtered out by is_module_in_config().
2019-06-28 18:34:39 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes: DefaultConfigurationChecks
2019-06-28 18:34:39 INFO  cmdline.prepare_import:138  ------ UCS@school import tool configured ------
2019-06-28 18:34:39 INFO  cmdline.prepare_import:139  Used configuration files: ['/usr/share/ucs-school-import/configs/global_defaults.json', '/var/lib/ucs-school-import/configs/global.json', '/usr/share/ucs-school-import/configs/user_import_defaults.json', '/var/lib/ucs-school-import/configs/user_import.json', '/tmp/34_import-users_via_cli_v2.xGMtQ2/config.b0rEhM'].
2019-06-28 18:34:39 INFO  cmdline.prepare_import:140  Using command line arguments: {'input': {'filename': '/tmp/34_import-users_via_cli_v2.xGMtQ2/users.7gyybz'}, 'verbose': True}
2019-06-28 18:34:39 INFO  cmdline.prepare_import:141  Configuration is:
{u'activate_new_users': {u'default': True},
 u'classes': {},  
 u'configuration_checks': [u'defaults'],
 u'csv': {u'allowed_missing_columns': [],
          u'header_lines': 1,
          u'incell-delimiter': {u'default': u','},
          u'mapping': {u'Benutzername': u'name',
                       u'Beschreibung': u'description',
                       u'E-Mail': u'email',
                       u'Gruppen': u'school_classes',
                       u'Nach': u'lastname',
                       u'OUs': u'schools',
                       u'Vor': u'firstname',
                       u'record_uid': u'record_uid',
                       u'role': u'__role',
                       u'school': u'school'}},
 u'deletion_grace_period': {u'deactivation': 0, u'deletion': 0},
 u'dry_run': False,
 u'factory': u'ucsschool.importer.default_user_import_factory.DefaultUserImportFactory',
 u'hooks_dir_pyhook': u'/usr/share/ucs-school-import/pyhooks',
 u'input': {u'filename': '/tmp/34_import-users_via_cli_v2.xGMtQ2/users.7gyybz',
            u'type': u'csv'},
 u'logfile': u'/var/log/univention/ucs-school-import.log',
 u'maildomain': u'nstx212.ucs',
 u'mandatory_attributes': [u'firstname',
                           u'lastname',
                           u'name',
                           u'record_uid',
                           u'school',
                           u'source_uid'],
 u'no_delete': False,
 u'normalize': {u'firstname': False, u'lastname': False},
 u'output': {u'new_user_passwords': None,
             u'user_import_summary': u'/var/lib/ucs-school-import/summary/%Y/%m/user_import_summary_%Y-%m-%d_%H:%M:%S.csv'},
 u'password_length': 15,
 u'scheme': {u'email': u'<:umlauts><firstname>[0].<lastname>@<maildomain>',
             u'record_uid': u'<firstname>;<lastname>;<email>',
             u'username': {u'default': u'<:umlauts><firstname>[0].<lastname>[COUNTER2]'}},
 u'school': None,
 u'school_classes_keep_if_empty': True,
 u'source_uid': u'source_uid-p2hpoelej7',
 u'tolerate_errors': 0,
 u'user_role': None,
 u'username': {u'allowed_special_chars': u'.',
               'max_length': {'default': 20, 'student': 15}},
 u'verbose': True}
2019-06-28 18:34:39 INFO  cmdline.do_import:119  ------ Starting mass import... ------
2019-06-28 18:34:39 INFO  utils.stopped_notifier:535  Stopping univention-directory-notifier
2019-06-28 18:34:44 INFO  utils._run:529  Stopping univention-directory-notifier (via systemctl): univention-directory-notifier.service.
                  
2019-06-28 18:34:44 ERROR utils._run:531  Failed to open /dev/tty: Kein passendes Gerät bzw. keine passende Adresse gefunden
                  
2019-06-28 18:34:44 INFO  utils.stopped_notifier:547  univention-directory-notifier stopped
2019-06-28 18:34:44 INFO  mass_import.import_users:110  ------ Importing users... ------
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'PreReadPyHook' in: /usr/share/ucs-school-import/pyhooks...
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes:
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_objects:163  Loaded hooks: {}.
2019-06-28 18:34:44 INFO  user_import.read_input:102  ------ Starting to read users from input data... ------
2019-06-28 18:34:44 DEBUG csv_reader.read:145  Reading '/tmp/34_import-users_via_cli_v2.xGMtQ2/users.7gyybz' with encoding 'us-ascii'.
2019-06-28 18:34:44 DEBUG base_reader.next:85  Input 2: ['d60afffppg', 'mz5d4mhz9t@nstx212.ucs', 'zgxawm7npj', '', 'mz5d4mhz9t', '', '6l61a1z', 'mz5d4mhz9t', 'student', '6l61a1z'] -> {u'school': u'6l61a1z', u'record_uid': u'mz5d4mhz9t', u'Gruppen': u'', u'Nach': u'zgxawm7npj', u'Benutzername': u'mz5d4mhz9t', u'Beschreibung': u'', u'E-Mail': u'mz5d4mhz9t@nstx212.ucs', u'role': u'student', u'Vor': u'd60afffppg', u'OUs': u'6l61a1z'}       
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'PostReadPyHook' in: /usr/share/ucs-school-import/pyhooks...
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes:
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_objects:163  Loaded hooks: {}.
2019-06-28 18:34:44 DEBUG csv_reader.map:308  ImportStudent(name=u'mz5d4mhz9t', school=u'6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None) attributes={'record_uid': u'mz5d4mhz9t', 'disabled': None, 'objectType': 'users/user', 'old_user': None, 'display_name': u'd60afffppg zgxawm7npj', 'source_uid': None, 'type_name': 'Student', 'in_hook': False, 'udm_properties': {u'description': u''}, 'type': 'importStudent', 'email': u'mz5d4mhz9t@nstx212.ucs', '$dn$': u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', 'firstname': u'd60afffppg', 'lastname': u'zgxawm7npj', 'entry_count': 0, 'schools': u'6l61a1z', 'password': None, 'school': u'6l61a1z', 'name': u'mz5d4mhz9t', 'roles': ['pupil'], 'ucsschool_roles': [], 'school_classes': {}, 'input_data': [], 'birthday': None, 'action': None} udm_properties={u'description': u''} action=None
2019-06-28 18:34:44 INFO  user_import.read_input:106  Done reading 1. user: ImportStudent(name=u'mz5d4mhz9t', school=u'6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None)                 
2019-06-28 18:34:44 DEBUG base_reader.next:85  Input 3: ['m7uiumexho', 'e7gb97xlog@nstx212.ucs', 'p9rnc7yerb', '', 'e7gb97xlog', '', '6l61a1z', 'e7gb97xlog', 'teacher', '6l61a1z'] -> {u'school': u'6l61a1z', u'record_uid': u'e7gb97xlog', u'Gruppen': u'', u'Nach': u'p9rnc7yerb', u'Benutzername': u'e7gb97xlog', u'Beschreibung': u'', u'E-Mail': u'e7gb97xlog@nstx212.ucs', u'role': u'teacher', u'Vor': u'm7uiumexho', u'OUs': u'6l61a1z'}       
2019-06-28 18:34:44 DEBUG csv_reader.map:308  ImportTeacher(name=u'e7gb97xlog', school=u'6l61a1z', dn=u'uid=e7gb97xlog,cn=lehrer,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None) attributes={'record_uid': u'e7gb97xlog', 'disabled': None, 'objectType': 'users/user', 'old_user': None, 'display_name': u'm7uiumexho p9rnc7yerb', 'source_uid': None, 'type_name': 'Teacher', 'in_hook': False, 'udm_properties': {u'description': u''}, 'type': 'importTeacher', 'email': u'e7gb97xlog@nstx212.ucs', '$dn$': u'uid=e7gb97xlog,cn=lehrer,cn=users,ou=6l61a1z,dc=nstx,dc=local', 'firstname': u'm7uiumexho', 'lastname': u'p9rnc7yerb', 'entry_count': 0, 'schools': u'6l61a1z', 'password': None, 'school': u'6l61a1z', 'name': u'e7gb97xlog', 'roles': ['teacher'], 'ucsschool_roles': [], 'school_classes': {}, 'input_data': [], 'birthday': None, 'action': None} udm_properties={u'description': u''} action=None
2019-06-28 18:34:44 INFO  user_import.read_input:106  Done reading 2. user: ImportTeacher(name=u'e7gb97xlog', school=u'6l61a1z', dn=u'uid=e7gb97xlog,cn=lehrer,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None)
2019-06-28 18:34:44 DEBUG base_reader.next:85  Input 4: ['n8gs4vihiv', 'vkk4cmkgyz@nstx212.ucs', 'vuesqb1m5b', '', 'vkk4cmkgyz', '', '6l61a1z', 'vkk4cmkgyz', 'teacher_and_staff', '6l61a1z'] -> {u'school': u'6l61a1z', u'record_uid': u'vkk4cmkgyz', u'Gruppen': u'', u'Nach': u'vuesqb1m5b', u'Benutzername': u'vkk4cmkgyz', u'Beschreibung': u'', u'E-Mail': u'vkk4cmkgyz@nstx212.ucs', u'role': u'teacher_and_staff', u'Vor': u'n8gs4vihiv', u'OUs': u'6l61a1z'}
2019-06-28 18:34:44 DEBUG csv_reader.map:308  ImportTeachersAndStaff(name=u'vkk4cmkgyz', school=u'6l61a1z', dn=u'uid=vkk4cmkgyz,cn=lehrer und mitarbeiter,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None) attributes={'record_uid': u'vkk4cmkgyz', 'disabled': None, 'objectType': 'users/user', 'old_user': None, 'display_name': u'n8gs4vihiv vuesqb1m5b', 'source_uid': None, 'type_name': 'Teacher and Staff', 'in_hook': False, 'udm_properties': {u'description': u''}, 'type': 'importTeachersAndStaff', 'email': u'vkk4cmkgyz@nstx212.ucs', '$dn$': u'uid=vkk4cmkgyz,cn=lehrer und mitarbeiter,cn=users,ou=6l61a1z,dc=nstx,dc=local', 'firstname': u'n8gs4vihiv', 'lastname': u'vuesqb1m5b', 'entry_count': 0, 'schools': u'6l61a1z', 'password': None, 'school': u'6l61a1z', 'name': u'vkk4cmkgyz', 'roles': ['teacher', 'staff'], 'ucsschool_roles': [], 'school_classes': {}, 'input_data': [], 'birthday': None, 'action': None} udm_properties={u'description': u''} action=None
2019-06-28 18:34:44 INFO  user_import.read_input:106  Done reading 3. user: ImportTeachersAndStaff(name=u'vkk4cmkgyz', school=u'6l61a1z', dn=u'uid=vkk4cmkgyz,cn=lehrer und mitarbeiter,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None)
2019-06-28 18:34:44 INFO  user_import.read_input:115  ------ Read 3 users from input data. ------
2019-06-28 18:34:44 INFO  user_import.detect_users_to_delete:336  ------ Detecting which users to delete... ------
2019-06-28 18:34:44 DEBUG user_import.get_ids_of_existing_users:322  Searching with filter=u'(&(|(objectClass=ucsschoolTeacher)(objectClass=ucsschoolStaff)(objectClass=ucsschoolStudent))(ucsschoolSourceUID=source_uid-p2hpoelej7)(ucsschoolRecordUID=*))'
2019-06-28 18:34:44 DEBUG user_import.detect_users_to_delete:346  users_to_delete=[]
2019-06-28 18:34:44 INFO  user_import.delete_users:364  ------ Deleting 0 users... ------
2019-06-28 18:34:44 INFO  user_import.delete_users:400  ------ Deleted 0 users. ------
2019-06-28 18:34:44 INFO  user_import.create_and_modify_users:131  ------ Creating / modifying users... ------
2019-06-28 18:34:44 DEBUG user_import.create_and_modify_users:148  Creating / modifying user 1/3 ImportStudent(name=u'mz5d4mhz9t', school=u'6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None)...
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting ImportStudent UDM object by filter: (&(|(objectClass=ucsschoolTeacher)(objectClass=ucsschoolStaff)(objectClass=ucsschoolStudent))(ucsschoolSourceUID=source_uid-p2hpoelej7)(ucsschoolRecordUID=mz5d4mhz9t))
2019-06-28 18:34:44 DEBUG csv_reader.read:145  Reading '/tmp/34_import-users_via_cli_v2.xGMtQ2/users.7gyybz' with encoding 'us-ascii'.
2019-06-28 18:34:44 INFO  import_user.make_classes:598  Reverting school_classes of ImportStudent(name=u'mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn=None) to previous value {'df6fg758u6q5': ['df6fg758u6q5-t7l6zp8h7d']}.
2019-06-28 18:34:44 INFO  user_import.determine_add_modify_action:284  User will change school. Previous school: 'df6fg758u6q5', new school: '6l61a1z'.
2019-06-28 18:34:44 INFO  user_import.school_move:412  Moving ImportStudent(name='mz5d4mhz9t', school='df6fg758u6q5', dn='uid=mz5d4mhz9t,cn=schueler,cn=users,ou=df6fg758u6q5,dc=nstx,dc=local') from school 'df6fg758u6q5' to '6l61a1z'...
2019-06-28 18:34:44 DEBUG base.get_all:814  Getting all School of None with filter '(objectClass=ucsschoolOrganizationalUnit)'
2019-06-28 18:34:44 DEBUG base.get_udm_object:739  Getting School UDM object by dn: ou=df6fg758u6q5,dc=nstx,dc=local
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting ImportStudent UDM object by filter: &(!(uid=mz5d4mhz9t))(mailPrimaryAddress=mz5d4mhz9t@nstx212.ucs)
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'UserPyHook' in: /usr/share/ucs-school-import/pyhooks...
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes:
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_objects:163  Loaded hooks: {}.
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/user_move_pre.d not found or empty.
2019-06-28 18:34:44 DEBUG base.from_dn:930  Looking up School with dn 'ou=6l61a1z,dc=nstx,dc=local'
2019-06-28 18:34:44 INFO  base.move_without_hooks:611  Moving 'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=df6fg758u6q5,dc=nstx,dc=local' to ImportStudent(name='mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', old_dn='uid=mz5d4mhz9t,cn=schueler,cn=users,ou=df6fg758u6q5,dc=nstx,dc=local')
2019-06-28 18:34:44 DEBUG base.from_dn:930  Looking up ExamStudent with dn 'uid=exam-mz5d4mhz9t,cn=examusers,ou=df6fg758u6q5,dc=nstx,dc=local'
2019-06-28 18:34:44 INFO  user.do_school_change:587  No exam user for 'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=df6fg758u6q5,dc=nstx,dc=local' found: No such object
2019-06-28 18:34:44 INFO  base.do_school_change:646  Going to move 'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=df6fg758u6q5,dc=nstx,dc=local' from school 'df6fg758u6q5' to '6l61a1z'
2019-06-28 18:34:44 INFO  user.do_school_change:304  User is part of the following groups: ['cn=schueler-df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local', 'cn=Domain Users df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local', 'cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=schueler,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local']
2019-06-28 18:34:44 DEBUG base.get_all:814  Getting all SchoolClass of df6fg758u6q5 with filter '(uniqueMember=uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local)'
2019-06-28 18:34:44 INFO  user.remove_from_groups_of_school:444  Removing u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local' from group 'cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=schueler,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local' of school 'df6fg758u6q5'.
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/group_modify_pre.d not found or empty.
2019-06-28 18:34:44 INFO  base.modify_without_hooks:539  Modifying SchoolClass(name='df6fg758u6q5-t7l6zp8h7d', school='df6fg758u6q5', dn='cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=schueler,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local')
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting SchoolClass UDM object by filter: name=df6fg758u6q5-t7l6zp8h7d
2019-06-28 18:34:44 INFO  base.modify_without_hooks:571  SchoolClass(name='df6fg758u6q5-t7l6zp8h7d', school='df6fg758u6q5', dn='cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=schueler,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local') successfully modified
2019-06-28 18:34:44 DEBUG base.get_udm_object:739  Getting ClassShare UDM object by dn: cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=shares,ou=df6fg758u6q5,dc=nstx,dc=local
2019-06-28 18:34:44 DEBUG base.get_udm_object:739  Getting ClassShare UDM object by dn: cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=shares,ou=df6fg758u6q5,dc=nstx,dc=local
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/share_create_pre.d not found or empty.
2019-06-28 18:34:44 INFO  base.create_without_hooks:478  Creating ClassShare(name='df6fg758u6q5-t7l6zp8h7d', school='df6fg758u6q5', dn='cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=shares,ou=df6fg758u6q5,dc=nstx,dc=local')           
2019-06-28 18:34:44 DEBUG base.get_udm_object:739  Getting School UDM object by dn: ou=df6fg758u6q5,dc=nstx,dc=local
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting SchoolClass UDM object by filter: name=df6fg758u6q5-t7l6zp8h7d
2019-06-28 18:34:44 DEBUG base.from_dn:930  Looking up School with dn 'ou=df6fg758u6q5,dc=nstx,dc=local'
2019-06-28 18:34:44 INFO  share.do_create:75  Creating share on "dcdf6fg758u6q5-01.nstx212.ucs"
2019-06-28 18:34:44 INFO  base.create_without_hooks:502  ClassShare(name='df6fg758u6q5-t7l6zp8h7d', school='df6fg758u6q5', dn='cn=df6fg758u6q5-t7l6zp8h7d,cn=klassen,cn=shares,ou=df6fg758u6q5,dc=nstx,dc=local') successfully created
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/share_create_post.d not found or empty.
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/group_modify_post.d not found or empty.
2019-06-28 18:34:44 DEBUG base.get_all:814  Getting all WorkGroup of df6fg758u6q5 with filter '(uniqueMember=uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local)'
2019-06-28 18:34:44 DEBUG base.get_all:814  Getting all SchoolGroup of df6fg758u6q5 with filter '(uniqueMember=uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local)'
2019-06-28 18:34:44 INFO  user.remove_from_groups_of_school:444  Removing u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local' from group 'cn=schueler-df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local' of school 'df6fg758u6q5'.
2019-06-28 18:34:44 INFO  base.modify_without_hooks:539  Modifying SchoolGroup(name='schueler-df6fg758u6q5', school='df6fg758u6q5', dn='cn=schueler-df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local')
2019-06-28 18:34:44 DEBUG base.get_udm_object:739  Getting School UDM object by dn: ou=df6fg758u6q5,dc=nstx,dc=local
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting SchoolGroup UDM object by filter: name=schueler-df6fg758u6q5
2019-06-28 18:34:44 INFO  base.modify_without_hooks:571  SchoolGroup(name='schueler-df6fg758u6q5', school='df6fg758u6q5', dn='cn=schueler-df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local') successfully modified            
2019-06-28 18:34:44 INFO  user.remove_from_groups_of_school:444  Removing u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local' from group 'cn=Domain Users df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local' of school 'df6fg758u6q5'.
2019-06-28 18:34:44 INFO  base.modify_without_hooks:539  Modifying SchoolGroup(name='Domain Users df6fg758u6q5', school='df6fg758u6q5', dn='cn=Domain Users df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local')                
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting SchoolGroup UDM object by filter: name=Domain Users df6fg758u6q5
2019-06-28 18:34:44 INFO  base.modify_without_hooks:571  SchoolGroup(name='Domain Users df6fg758u6q5', school='df6fg758u6q5', dn='cn=Domain Users df6fg758u6q5,cn=groups,ou=df6fg758u6q5,dc=nstx,dc=local') successfully modified    
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting ImportStudent UDM object by filter: username=mz5d4mhz9t
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/group_create_pre.d not found or empty.
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting Group UDM object by filter: name=Domain Users 6l61a1z
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting Group UDM object by filter: name=schueler-6l61a1z
2019-06-28 18:34:44 DEBUG base.from_dn:930  Looking up School with dn 'ou=6l61a1z,dc=nstx,dc=local'
2019-06-28 18:34:44 DEBUG base.get_all:814  Getting all AnyComputer of 6l61a1z with filter '(univentionService=Windows Profile Server)'
2019-06-28 18:34:44 INFO  base.do_move_roles:1074  Updating roles: ['student:school:df6fg758u6q5'] -> ['student:school:6l61a1z']...
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/user_move_post.d not found or empty.
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting ImportStudent UDM object by filter: (&(|(objectClass=ucsschoolTeacher)(objectClass=ucsschoolStaff)(objectClass=ucsschoolStudent))(ucsschoolSourceUID=source_uid-p2hpoelej7)(ucsschoolRecordUID=mz5d4mhz9t))
2019-06-28 18:34:44 INFO  user_import.create_and_modify_users:164  Modifying ImportStudent(name=u'mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local') (source_uid:source_uid-p2hpoelej7 record_uid:mz5d4mhz9t) attributes: {'$dn$': u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local', 'action': 'M', 'birthday': None, 'disabled': '0', 'display_name': u'd60afffppg zgxawm7npj', 'email': u'mz5d4mhz9t@nstx212.ucs', 'entry_count': 2L, 'firstname': u'd60afffppg', 'in_hook': False, 'input_data': ['d60afffppg', 'mz5d4mhz9t@nstx212.ucs', 'zgxawm7npj', '', 'mz5d4mhz9t', '', '6l61a1z', 'mz5d4mhz9t', 'student', '6l61a1z'], 'lastname': u'zgxawm7npj', 'name': u'mz5d4mhz9t', 'objectType': 'users/user', 'old_user': ImportStudent(name='mz5d4mhz9t', school='df6fg758u6q5', dn='uid=mz5d4mhz9t,cn=schueler,cn=users,ou=df6fg758u6q5,dc=nstx,dc=local'), 'password': None, 'record_uid': u'mz5d4mhz9t', 'roles': ['pupil'], 'school': '6l61a1z', 'school_classes': {'df6fg758u6q5': ['df6fg758u6q5-t7l6zp8h7d']}, 'schools': ['6l61a1z'], 'source_uid': u'source_uid-p2hpoelej7', 'type': 'importStudent', 'type_name': 'Student', 'ucsschool_roles': ['student:school:6l61a1z'], 'udm_properties': {u'description': u''}}...
2019-06-28 18:34:44 DEBUG base.call_hooks:415  /usr/share/ucs-school-import/hooks/user_modify_pre.d not found or empty.
2019-06-28 18:34:44 INFO  base.modify_without_hooks:539  Modifying ImportStudent(name=u'mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local')
2019-06-28 18:34:44 DEBUG base.get_udm_object:739  Getting School UDM object by dn: ou=6l61a1z,dc=nstx,dc=local
2019-06-28 18:34:44 DEBUG base.get_only_udm_obj:947  Getting ImportStudent UDM object by filter: &(!(uid=mz5d4mhz9t))(mailPrimaryAddress=mz5d4mhz9t@nstx212.ucs)
2019-06-28 18:34:44 ERROR user_import.create_and_modify_users:212  Entry #0: ValidationError when modifying ImportStudent(name=u'mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local') (source_uid:source_uid-p2hpoelej7 record_uid: mz5d4mhz9t): {'school_classes': ["School 'df6fg758u6q5' in 'school_classes' is missing in the users 'school(s)' attributes."]} ValidationError({'school_classes': ["School 'df6fg758u6q5' in 'school_classes' is missing in the users 'school(s)' attributes."]},)
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 192, in create_and_modify_users
    success = user.modify(lo=self.connection)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 863, in modify
    res = super(ImportUser, self).modify(lo, validate, move_if_necessary)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 533, in modify
    success = self.modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 883, in modify_without_hooks
    return super(ImportUser, self).modify_without_hooks(lo, validate, move_if_necessary)
  File "/usr/lib/pymodules/python2.7/ucsschool/lib/models/base.py", line 549, in modify_without_hooks
    raise ValidationError(self.errors.copy())
UserValidationError: ValidationError when modifying ImportStudent(name=u'mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local') (source_uid:source_uid-p2hpoelej7 record_uid: mz5d4mhz9t): {'school_classes': ["School 'df6fg758u6q5' in 'school_classes' is missing in the users 'school(s)' attributes."]} ValidationError({'school_classes': ["School 'df6fg758u6q5' in 'school_classes' is missing in the users 'school(s)' attributes."]},)
2019-06-28 18:34:44 ERROR mass_import.import_users:123  More than 0 errors.
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/mass_import.py", line 120, in import_users
    user_import.create_and_modify_users(imported_users)  # 90% - 100%
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 213, in create_and_modify_users
    self._add_error(exc)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 630, in _add_error
    raise TooManyErrors("More than {} errors.".format(self.config["tolerate_errors"]), self.errors)
TooManyErrors: More than 0 errors.
2019-06-28 18:34:44 INFO  user_import.log_stats:585  ------ User import statistics ------
2019-06-28 18:34:44 INFO  user_import.log_stats:618  Read users from input data: 3
2019-06-28 18:34:44 INFO  user_import.log_stats:618  Created ImportStudent: 0
2019-06-28 18:34:44 INFO  user_import.log_stats:618  Modified ImportStudent: 0
2019-06-28 18:34:44 INFO  user_import.log_stats:618  Deleted ImportStudent: 0
2019-06-28 18:34:44 INFO  user_import.log_stats:618  Errors: 2
2019-06-28 18:34:44 INFO  user_import.log_stats:618  Entry |    User    | Error description
2019-06-28 18:34:44 INFO  user_import.log_stats:618  --------------------------------------
2019-06-28 18:34:44 INFO  user_import.log_stats:618      0 | mz5d4mhz9t | ValidationError when modifying ImportStudent(name=u'mz5d4mhz9t', school='6l61a1z', dn=u'uid=mz5d4mhz9t,cn=schueler,cn=users,ou=6l61a1z,dc=nstx,dc=local') (source_uid:source_uid-p2hpoelej7 record_uid: mz5d4mhz9t): {'school_classes': ["School 'df6fg758u6q5' in 'school_classes' is missing in the users 'school(s)' attributes."]} ValidationError({'school_classes': ["School 'df6fg758u6q5' in 'school_classes' is missing in the users 'school(s)' attributes."]},)
2019-06-28 18:34:44 INFO  user_import.log_stats:618      0 |  <No name> | More than 0 errors.
2019-06-28 18:34:44 INFO  user_import.log_stats:619  ------ End of user import statistics ------
2019-06-28 18:34:44 INFO  mass_import.import_users:136  ------ Writing user import summary to /var/lib/ucs-school-import/summary/2019/06/user_import_summary_2019-06-28_18:34:44.csv... ------
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:110  Searching for hooks of type 'ResultPyHook' in: /usr/share/ucs-school-import/pyhooks...
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_classes:125  Found hook classes:
2019-06-28 18:34:44 INFO  pyhooks_loader.get_hook_objects:163  Loaded hooks: {}.
2019-06-28 18:34:44 INFO  mass_import.import_users:140  ------ Importing users done. ------
2019-06-28 18:34:44 INFO  utils.stopped_notifier:557  Starting univention-directory-notifier
2019-06-28 18:34:45 INFO  utils._run:529  Starting univention-directory-notifier (via systemctl): univention-directory-notifier.service.
                  
2019-06-28 18:34:45 ERROR utils._run:531  Failed to open /dev/tty: Kein passendes Gerät bzw. keine passende Adresse gefunden
                  
2019-06-28 18:34:45 INFO  utils.stopped_notifier:564  univention-directory-notifier started
2019-06-28 18:34:45 INFO  cmdline.do_import:125  ------ Mass import finished. ------
2019-06-28 18:34:45 INFO  importusers_cli_v2.run_import:508  Import process exited with exit code 1
2019-06-28 18:34:45 ERROR importusers_cli_v2.run_import:510  As requested raising an exception due to non-zero exit code
Comment 1 Sönke Schwardt-Krummrich univentionstaff 2019-08-11 22:38:09 CEST
This is reproducible via the new test script 
207a_import-users_school_change_and_classes in ucs-test-ucsschool 6.0.39
Comment 2 Daniel Tröder univentionstaff 2019-08-12 09:51:25 CEST
When the school_classes_keep_if_empty setting is enabled, the classes a user has are restored before the modified user is saved to LDAP.
When a user was moved to another school, the classes of schools he is not a member of anymore, are removed.

[4.4] 1b6772210 Bug #49995: fix handling of school_classes_keep_if_empty when moving users to another school
[4.4] be6b48f57 Bug #49995: changelog
[4.4] cf103b71a Bug #49995: advisory

ucs-school-import (17.0.11)
ucs-test-ucsschool (6.0.40)
Comment 3 Sönke Schwardt-Krummrich univentionstaff 2019-08-13 13:04:17 CEST
OK: code change
OK: installation
OK: update
OK: ucs-test
OK: changelog entry
OK: advisory
OK: changelog xml
NOT YET: changes applied to 4.3 branch
OK: changes applied to 4.4 branch
OK: functional change
OK: package built and installable
Comment 4 Sönke Schwardt-Krummrich univentionstaff 2019-08-14 14:02:22 CEST
UCS@school 4.4 v3 has been released.

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

If this error occurs again, please clone this bug.