Univention Bugzilla – Bug 41651
Prettify ucs-school-import cli output
Last modified: 2020-07-13 12:43:08 CEST
Log output on CLI is currently extremely verbose. It's basically not possible to tell from the command line what actually happened during import. 1. minimalistic cmdline-output + move logfile-name to top 2. option to make progress visible on cmdline 3. create CSV with only failed imports, that can easily be reimported 4. notifier stopping/starting should not be logged as warning since it is part of the expected behavior An output like the following is suggested: ------ UCS@school mass import ------ ------ Detailed logging in /var/log/ucs-school-import.log ------ ------ Starting to read users from input data ------ 3 lines ------ Read 3 users from input data ------ ------ Creating / modifying users ------ Creating 0 users. Modifying 3 users. ------ Deleting user ------ Deleting 1 users. ------ User import statistics ------ Errors: 0 Modifications per school (create, modify, delete, error): schule1: created: 0, modified: 3, deleted: 0, errors: 0 schule2: created: 0, modified: 0, deleted: 1, errors: 0 ------ Writing user import summary to /var/lib/ucs-school-import/user_import_summary_2016-06-15_21:06:01.csv ------ ------ Mass import finished. ------
What about errors? - Should they be printed when they happen? - Should they be printed at the end? - Should they contain tracebacks? They are listed without traceback in the summary.csv anyway. They are listed with traceback in the debug logfile.
Split 3. create CSV with only failed imports, that can easily be reimported into separate Bug #41652
I'd recommend to print _no_ tracebacks and keep them with detailed error messages to the logfile.
*** Bug 42412 has been marked as a duplicate of this bug. ***
Also the exception UsernameToLong in Bug #42464 should be displayed more user friendly.
Entry #3: RecordUID '' has already been used in this import. Traceback (most recent call last): File "/usr/lib/pymodules/python2.7/ucsschool/importer/mass_import/user_import.py", line 106, 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 195, 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 228, in prepare_all self.run_checks(check_username=new_user) File "/usr/lib/pymodules/python2.7/ucsschool/importer/models/import_user.py", line 569, in run_checks entry=self.entry_count, import_user=self) UniqueIdError: RecordUID '' has already been used in this import.
(In reply to Florian Best from comment #5) > Also the exception UsernameToLong in Bug #42464 should be displayed more > user friendly. It currently is: "Username '{}' is longer than allowed." It could be enhanced to: "Username '{}' is longer than allowed (only {} characters are allowed)." (→username_max_length) (In reply to Florian Best from comment #6) > Entry #3: RecordUID '' has already been used in this import. I think the message is clear. How would you improve it?
(In reply to Daniel Tröder from comment #7) > (In reply to Florian Best from comment #5) > > Also the exception UsernameToLong in Bug #42464 should be displayed more > > user friendly. > It currently is: > "Username '{}' is longer than allowed." > It could be enhanced to: > "Username '{}' is longer than allowed (only {} characters are allowed)." > (→username_max_length) > > > (In reply to Florian Best from comment #6) > > Entry #3: RecordUID '' has already been used in this import. > I think the message is clear. How would you improve it? Yes, the messages are fine! I just want that one cannot see the traceback.
I got feedback from a customer that there are too much information on stdout/stderr when executing ucs-school-import.
Created attachment 8278 [details] dump configuration as JSON When printing the configuration at startup, use JSON output to simplify debugging (copy & paste configuration to reproduce setup).
(In reply to Daniel Tröder from comment #10) > Created attachment 8278 [details] > dump configuration as JSON BTW: untested - pprint.pformat() can/should probably be removed
This issue has been filed against UCS@school 4.1. UCS@school 4.1 is out of maintenance and many UCS@school components have changed in later releases. Thus, this issue is now being closed. If this issue still occurs in newer UCS@school versions, please reopen it and update the UCS@school version. In this case please provide detailed information on how this issue is affecting you.