Bug 41651 - Prettify ucs-school-import cli output
Prettify ucs-school-import cli output
Status: REOPENED
Product: UCS@school
Classification: Unclassified
Component: Import scripts
UCS@school 4.4
Other Linux
: P5 normal (vote)
: UCS@school 4.x
Assigned To: UCS@school maintainers
:
: 42412 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-06-23 13:50 CEST by Jan Christoph Ebersbach
Modified: 2020-07-13 12:43 CEST (History)
5 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 1: Cosmetic issue or missing function but workaround exists
Who will be affected by this bug?: 2: Will only affect a 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.023
Enterprise Customer affected?:
School Customer affected?: Yes
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:


Attachments
dump configuration as JSON (1.60 KB, patch)
2016-12-02 11:03 CET, Daniel Tröder
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Christoph Ebersbach univentionstaff 2016-06-23 13:50:06 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. ------
Comment 1 Daniel Tröder univentionstaff 2016-06-23 13:52:06 CEST
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.
Comment 2 Daniel Tröder univentionstaff 2016-06-23 13:58:03 CEST
Split
3. create CSV with only failed imports, that can easily be reimported
into separate Bug #41652
Comment 3 Jan Christoph Ebersbach univentionstaff 2016-06-23 14:20:54 CEST
I'd recommend to print _no_ tracebacks and keep them with detailed error messages to the logfile.
Comment 4 Daniel Tröder univentionstaff 2016-09-15 15:42:09 CEST
*** Bug 42412 has been marked as a duplicate of this bug. ***
Comment 5 Florian Best univentionstaff 2016-09-21 17:29:04 CEST
Also the exception UsernameToLong in Bug #42464 should be displayed more user friendly.
Comment 6 Florian Best univentionstaff 2016-09-21 17:38:26 CEST
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.
Comment 7 Daniel Tröder univentionstaff 2016-09-22 09:30:00 CEST
(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?
Comment 8 Florian Best univentionstaff 2016-09-22 10:52:46 CEST
(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.
Comment 9 Sönke Schwardt-Krummrich univentionstaff 2016-10-13 14:52:11 CEST
I got feedback from a customer that there are too much information on stdout/stderr when executing ucs-school-import.
Comment 10 Daniel Tröder univentionstaff 2016-12-02 11:03:38 CET
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).
Comment 11 Daniel Tröder univentionstaff 2016-12-02 11:08:50 CET
(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
Comment 12 Michel Smidt 2020-07-09 10:51:18 CEST
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.