Error beim User-Import


#1

Hallo zusammen,

ich versuche seit Stunden die Schüler mittels CSV-Datei zu Importieren. Dazu möchte ich gerne das Import-Script nutzen, da ich so die Record-UID nutzen kann…

Allerdings kann ich machen was ich will. Ich bekomme immer die Fehlermeldung

ERROR cmdline.main:124 0: No username in ‘.’.

Ich hoffe, dass ich hier evtl. Hilfe Finde.

Beste Grüße

Lucas

Hier die Ausgabe eines Import-Versuches:

------ UCS@school import tool starting ------
Reading configuration from '/usr/share/ucs-school-import/configs/global_defaults.json'...
Reading configuration from '/var/lib/ucs-school-import/configs/global.json'...
Reading configuration from '/usr/share/ucs-school-import/configs/user_import_defaults.json'...
Reading configuration from '/var/lib/ucs-school-import/configs/user_import.json'...
2017-08-25 23:22:35 INFO  cmdline.main:111  ------ UCS@school import tool configured ------
2017-08-25 23:22:35 INFO  cmdline.main:112  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'].
2017-08-25 23:22:35 INFO  cmdline.main:113  Using command line arguments: {'dry_run': True}
2017-08-25 23:22:35 INFO  cmdline.main:114  Configuration is:
{u'activate_new_users': {u'default': True},
 u'classes': {},
 u'csv': {u'header_lines': 1,
          u'incell-delimiter': {u'default': u';'},
          u'mapping': {}},
 u'dry_run': True,
 u'factory': u'ucsschool.importer.default_user_import_factory.DefaultUserImportFactory',
 u'input': {u'filename': u'/var/lib/ucs-school-import/userimport.csv',
            u'type': u'csv'},
 u'logfile': u'/var/log/univention/ucs-school-import.log',
 u'maildomain': u'rss-hamborn.de',
 u'mandatory_attributes': [u'firstname',
                           u'lastname',
                           u'record_UID',
                           u'birthday'],
 u'no_delete': False,
 u'output': {u'new_user_passwords': u'/var/lib/ucs-school-import/user_import_passwords_%Y-%m-%d_%H:%M:%S.csv',
             u'user_import_summary': u'/var/lib/ucs-school-import/user_import_summary_%Y-%m-%d_%H:%M:%S.csv'},
 u'password_length': 15,
 u'scheme': {u'email': u'<firstname>[0].<lastname>@<maildomain>',
             u'recordUID': u'<email>',
             u'username': {u'allow_rename': True,
                           u'default': u'<:umlauts><firstname>[0].<lastname>[COUNTER2]',
                           u'student': u'<firstname>.<lastname>'}},
 u'school': u'rss_sh',
 u'sourceUID': u'importschueler',
 u'tolerate_errors': 0,
 u'user_deletion': {u'delete': True, u'expiration': 0},
 u'user_role': u'student',
 u'verbose': True}
2017-08-25 23:22:35 INFO  cmdline.do_import:94  ------ Starting mass import... ------
2017-08-25 23:22:35 WARNING utils.stopped_notifier:294  Stopping univention-directory-notifier
2017-08-25 23:22:41 INFO  utils._run:288  Stopping univention-directory-notifier (via systemctl): univention-directory-notifier.service.

2017-08-25 23:22:41 INFO  utils.stopped_notifier:306  univention-directory-notifier stopped
2017-08-25 23:22:41 INFO  mass_import.import_users:94  ------ Importing users... ------
2017-08-25 23:22:41 INFO  user_import.read_input:75  ------ Starting to read users from input data... ------
2017-08-25 23:22:41 DEBUG base_reader.next:73  Input 2: ['6666', 'Fischer', 'Fritz', '07.01.1996', 'rss_sh-9A'] -> {u'name': u'07.01.1996', u'firstname': u'Fritz', u'school_classes': u'', u'birthday': u'rss_sh-9A', u'record_UID': u'6666', u'lastmane': u'Fischer'}
2017-08-25 23:22:41 DEBUG csv_reader.map:192  ImportStudent(name=None, school=None, dn=None) attributes={'record_uid': None, 'disabled': None, 'objectType': 'users/user', 'old_user': None, 'display_name': '', 'source_uid': None, 'type_name': 'Student', 'in_hook': False, 'udm_properties': {}, 'type': 'importStudent', 'email': None, '$dn$': None, 'firstname': None, 'lastname': None, 'entry_count': 0, 'schools': [], 'password': None, 'school': None, 'name': None, 'roles': ['pupil'], 'school_classes': {}, 'input_data': [], 'birthday': None, 'action': None} udm_properties={} action=None
2017-08-25 23:22:41 WARNING import_user.format_from_scheme:714  Created empty 'recordUID' from scheme '<email>' and input data {'$dn$': None, 'record_uid': None, 'firstname': None, 'lastname': None, 'disabled': None, 'entry_count': 2L, 'schools': [], 'password': None, 'objectType': 'users/user', 'school': None, 'old_user': None, 'display_name': '', 'source_uid': None, 'roles': ['pupil'], 'type_name': 'Student', 'name': None, 'input_data': ['6666', 'Fischer', 'Fritz', '07.01.1996', 'rss_sh-9A'], 'in_hook': False, 'birthday': None, 'udm_properties': {}, 'action': None, 'type': 'importStudent', 'email': None, 'school_classes': {}}. 
2017-08-25 23:22:41 INFO  user_import.read_input:79  Done reading 1. user: ImportStudent(name=None, school=None, dn=None)
2017-08-25 23:22:41 INFO  user_import.read_input:87  ------ Read 1 users from input data. ------
2017-08-25 23:22:41 INFO  user_import.detect_users_to_delete:207  ------ Detecting which users to delete... ------
2017-08-25 23:22:41 DEBUG user_import.detect_users_to_delete:236  users_to_delete=[]
2017-08-25 23:22:41 INFO  user_import.delete_users:251  ------ Deleting 0 users... ------
2017-08-25 23:22:41 INFO  user_import.delete_users:278  ------ Deleted 0 users. ------
2017-08-25 23:22:41 INFO  user_import.create_and_modify_users:101  ------ Creating / modifying users... ------
2017-08-25 23:22:41 DEBUG user_import.create_and_modify_users:110  Creating / modifying user 1/1 ImportStudent(name=None, school=None, dn=None)...
2017-08-25 23:22:41 DEBUG base.get_only_udm_obj:869  Getting ImportStudent UDM object by filter: (&(objectClass=ucsschoolType)(ucsschoolSourceUID=importschueler)(ucsschoolRecordUID=))
2017-08-25 23:22:41 WARNING import_user.format_from_scheme:714  Created empty 'recordUID' from scheme '<email>' and input data {'$dn$': None, 'record_uid': u'', 'firstname': None, 'lastname': None, 'disabled': None, 'entry_count': 2L, 'schools': [], 'password': None, 'objectType': 'users/user', 'school': None, 'old_user': None, 'display_name': '', 'source_uid': u'importschueler', 'roles': ['pupil'], 'type_name': 'Student', 'name': None, 'input_data': ['6666', 'Fischer', 'Fritz', '07.01.1996', 'rss_sh-9A'], 'in_hook': False, 'birthday': None, 'udm_properties': {}, 'action': None, 'type': 'importStudent', 'email': None, 'school_classes': {}}. 
2017-08-25 23:22:41 WARNING username_handler.remove_bad_chars:164  Removing disallowed dot from start and end of username '.'.
2017-08-25 23:22:41 ERROR user_import.create_and_modify_users:163  Entry #0: No username in '.'.
Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 111, in create_and_modify_users
    user = self.determine_add_modify_action(imported_user)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 196, in determine_add_modify_action
    imported_user.prepare_all(new_user=True)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 265, in prepare_all
    self.prepare_attributes(new_user)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 278, in prepare_attributes
    self.make_username()
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 532, in make_username
    self.name = self.username_handler.format_username(self.name)
  File "/usr/lib/pymodules/python2.7/ucsschool/importer/utils/username_handler.py", line 215, in format_username
    raise FormatError("No username in '{}'.".format(name), name, name)
FormatError: No username in '.'.
2017-08-25 23:22:41 WARNING utils.stopped_notifier:316  Starting univention-directory-notifier
2017-08-25 23:22:41 INFO  utils._run:288  Starting univention-directory-notifier (via systemctl): univention-directory-notifier.service.

2017-08-25 23:22:41 INFO  utils.stopped_notifier:323  univention-directory-notifier started
2017-08-25 23:22:41 ERROR cmdline.main:122  More than 0 errors. Exiting. Errors:
2017-08-25 23:22:41 ERROR cmdline.main:124  0: No username in '.'.

#2

Moin,

welches Tool hast du verwendet? ucs-school-user-import oder import_users?
Hat deine CSV-Quelldatei eine Header-Zeile?
Ich bin gerade etwas irritiert, dass in der Ausgabe bei “Configuration is” unter csv → mapping nichts eingetragen ist. Wenn die Zuordnung der einzelnen Spalten der CSV-Datei nicht automatisch funktioniert, solltest du manuell ein Mapping angeben (siehe dazu hier: http://docs.software-univention.de/ucsschool-import-handbuch-4.2.html#configuration:mapping).

Viele Grüße

Sönke