Univention Bugzilla – Bug 45673
no statistics, passwords and summary written when import aborts
Last modified: 2018-11-16 11:48:21 CET
When a UcsSchoolImportFatalError is raised (which can happen when more than config["tolerate_errors"] occur) statistics, passwords of new users and the import summary are not written to disk. This has not been a problem until now for customers, because the usual configurations exit on the first error and the other fatal errors occur mostly before creating the first user (configuration problems). The problem is, that without at least the summary in the logfile it is difficult to spot such a situation. The fix could be to move the exception catching code that is in cmdline.main() to mass_import.import_users().
*** Bug 47399 has been marked as a duplicate of this bug. ***
Fixed in branch dtroeder/45673_summary_when_abort: b997e83b2: Bug #45673: allow writing of statistics, passwords CSV and summary CSV when aborting import Known (UcsSchoolImportError) und unknown exceptions are caught before bypassing the result output code, and reraised after that did its work.
I forced an Exception, which was correctly catched by the outer Exception catcher. The summary was logged into my logfile and the exception raised again. Seems to work for me. After building I can do the final testing and verify ------ End of user import statistics ------ ------ Writing user import summary to /tmp/mylog.txt... ------ Searching for hooks of type 'ResultPyHook' in: /usr/share/ucs-school-import/pyhooks... Found hook classes: Loaded hooks: {}. ------ Importing users done. ------ Starting univention-directory-notifier Starting univention-directory-notifier (via systemctl): univention-directory-notifier.service. univention-directory-notifier started Outer Exception catcher: TypeError('expected string or buffer',) Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 121, in main self.do_import() File "/usr/lib/pymodules/python2.7/ucsschool/importer/frontend/cmdline.py", line 98, in do_import importer.mass_import() File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/mass_import.py", line 78, in mass_import self.import_users() File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/mass_import.py", line 129, in import_users raise exc TypeError: expected string or buffer
Addad a changelog entry, merged, built and created an advisory. ucs-school-import (16.0.2-50)
Changelog & Advisory: OK Tested by setting tolerate_errors in config to 2 and putting three errors in the CSV. Exception was thrown and catched by outer Exception catcher. Summary was written as intended.
UCS@school 4.3 v6 has been released. https://docs.software-univention.de/changelog-ucsschool-4.3v6-de.html If this error occurs again, please clone this bug.