Bug 43152

Summary: Improve error handling of setup scripts: write traceback to frontend
Product: UCS Reporter: Florian Best <best>
Component: UMC - Setup wizardAssignee: Florian Best <best>
Status: CLOSED FIXED QA Contact: Jürn Brodersen <brodersen>
Severity: normal    
Priority: P5    
Version: UCS 4.1   
Target Milestone: UCS 4.2-1-errata   
Hardware: Other   
OS: Linux   
See Also: https://forge.univention.org/bugzilla/show_bug.cgi?id=44483
https://forge.univention.org/bugzilla/show_bug.cgi?id=43745
What kind of report is it?: Bug Report What type of bug is this?: 6: Setup Problem: Issue for the setup process
Who will be affected by this bug?: 2: Will only affect a few installed domains How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.274 Enterprise Customer affected?:
School Customer affected?: ISV affected?:
Waiting Support: Flags outvoted (downgraded) after PO Review:
Ticket number: 2016112921000044, 2017070621000254 Bug group (optional): Error handling, External feedback, Troubleshooting
Max CVSS v3 score:

Description Florian Best univentionstaff 2016-12-09 17:58:35 CET
Version: 4.1-4 errata332 (Vahr)

Einrichten der Active-Directory-Verbindung:
Comment 1 Florian Best univentionstaff 2017-08-11 19:28:24 CEST
The problem here is the error handling in SetupScript:
»   »   except Exception as e:
»   »   »   self.error(str(e))

This writes an empty string as error message to the progress. We don't know which exception it was. The original error comes from usr/lib/univention-system-setup/scripts/90_postjoin/10admember.

Instead we should write the traceback into the progress, so that this is sent for all unhandled exceptions. All other setup scripts already handle exceptions well, so that no additional tracebacks would occur. If they need to pass a error string message to the frontend they can (and already do) call "self.error(message); return False" in inner_run().

Bug #43277 comment 2 also happens due to this.

univention-system-setup (10.0.10-37):
r82080 | Bug #43152: improve error handling of SetupScript by sending tracebacks to the frontend.

univention-system-setup.yaml:
r82081 | YAML Bug #43152
Comment 2 Florian Best univentionstaff 2017-08-15 16:34:01 CEST
*** Bug 45016 has been marked as a duplicate of this bug. ***
Comment 3 Jürn Brodersen univentionstaff 2017-08-28 12:29:15 CEST
Looks good to me :)

What I tested:
cd /usr/share/pyshared/univention/management/console/modules/setup/
python -c "from setup_script import SetupScript; foo = SetupScript(); foo.run()" > /tmp/test.log

Content of /tmp/test.log:
"""
__ERR__:Traceback (most recent call last):
  File "setup_script.py", line 310, in run
    success = self.inner_run()
  File "setup_script.py", line 334, in inner_run
    raise NotImplementedError('Define your own inner_run() method, please.')
NotImplementedError: Define your own inner_run() method, please.
Traceback (most recent call last):
  File "setup_script.py", line 310, in run
    success = self.inner_run()
  File "setup_script.py", line 334, in inner_run
    raise NotImplementedError('Define your own inner_run() method, please.')
NotImplementedError: Define your own inner_run() method, please.
"""
-> OK

YAML -> OK
Comment 4 Arvid Requate univentionstaff 2017-08-30 16:29:38 CEST
<http://errata.software-univention.de/ucs/4.2/150.html>