create crash reports
This commit is contained in:
parent
74ef2ad8f6
commit
7908a958d0
|
@ -25,6 +25,7 @@ import pyudev
|
|||
from subiquitycore.controller import BaseController
|
||||
from subiquitycore.utils import run_command
|
||||
|
||||
from subiquity.controllers.error import ErrorReportKind
|
||||
from subiquity.models.filesystem import (
|
||||
align_up,
|
||||
Bootloader,
|
||||
|
@ -67,6 +68,11 @@ class Probe:
|
|||
self.cb = cb
|
||||
self.state = ProbeState.NOT_STARTED
|
||||
self.result = None
|
||||
if restricted:
|
||||
self.kind = ErrorReportKind.DISK_PROBE_FAIL
|
||||
else:
|
||||
self.kind = ErrorReportKind.BLOCK_PROBE_FAIL
|
||||
self.crash_report = None
|
||||
|
||||
def start(self):
|
||||
block_discover_log.debug(
|
||||
|
@ -101,7 +107,8 @@ class Probe:
|
|||
except Exception:
|
||||
block_discover_log.exception(
|
||||
"probing failed restricted=%s", self.restricted)
|
||||
# Should make a crash report here!
|
||||
self.crash_report = self.controller.app.make_apport_report(
|
||||
self.kind, "block probing")
|
||||
self.state = ProbeState.FAILED
|
||||
else:
|
||||
block_discover_log.exception(
|
||||
|
@ -112,7 +119,8 @@ class Probe:
|
|||
def _check_timeout(self, loop, ud):
|
||||
if self.state != ProbeState.PROBING:
|
||||
return
|
||||
# Should make a crash report here!
|
||||
self.crash_report = self.controller.app.make_apport_report(
|
||||
self.kind, "block probing timed out")
|
||||
block_discover_log.exception(
|
||||
"probing timed out restricted=%s", self.restricted)
|
||||
self.state = ProbeState.FAILED
|
||||
|
@ -200,7 +208,8 @@ class FilesystemController(BaseController):
|
|||
except Exception:
|
||||
block_discover_log.exception(
|
||||
"load_probe_data failed restricted=%s", probe.restricted)
|
||||
# Should make a crash report here!
|
||||
probe.crash_report = self.app.make_apport_report(
|
||||
probe.kind, "loading probe data")
|
||||
if not probe.restricted:
|
||||
self._start_probe(restricted=True)
|
||||
else:
|
||||
|
|
|
@ -40,6 +40,7 @@ import yaml
|
|||
from subiquitycore import utils
|
||||
from subiquitycore.controller import BaseController
|
||||
|
||||
from subiquity.controllers.error import ErrorReportKind
|
||||
from subiquity.ui.views.installprogress import ProgressView
|
||||
|
||||
|
||||
|
@ -161,7 +162,7 @@ class StateMachine:
|
|||
raise
|
||||
except Exception:
|
||||
log.debug("%s failed", name)
|
||||
self.controller.curtin_error(traceback.format_exc())
|
||||
self.controller.curtin_error()
|
||||
else:
|
||||
log.debug("%s completed", name)
|
||||
if 'success' in self._transitions[name]:
|
||||
|
@ -251,12 +252,13 @@ class InstallProgressController(BaseController):
|
|||
def snap_config_done(self):
|
||||
self._step_done('snap')
|
||||
|
||||
def curtin_error(self, log_text=None):
|
||||
log.debug('curtin_error: %s', log_text)
|
||||
def curtin_error(self):
|
||||
self.install_state = InstallState.ERROR
|
||||
self.app.make_apport_report(
|
||||
ErrorReportKind.INSTALL_FAIL, "install failed")
|
||||
self.progress_view.spinner.stop()
|
||||
if log_text:
|
||||
self.progress_view.add_log_line(log_text)
|
||||
if sys.exc_info()[0] is not None:
|
||||
self.progress_view.add_log_line(traceback.format_exc())
|
||||
self.progress_view.set_status(('info_error',
|
||||
_("An error has occurred")))
|
||||
self.progress_view.show_complete(True)
|
||||
|
|
|
@ -25,6 +25,7 @@ from subiquitycore.core import Application
|
|||
|
||||
from subiquity.controllers.error import (
|
||||
ErrorController,
|
||||
ErrorReportKind,
|
||||
)
|
||||
from subiquity.models.subiquity import SubiquityModel
|
||||
from subiquity.snapd import (
|
||||
|
@ -104,6 +105,16 @@ class Subiquity(Application):
|
|||
self._apport_data = []
|
||||
self._apport_files = []
|
||||
|
||||
def run(self):
|
||||
try:
|
||||
super().run()
|
||||
except Exception:
|
||||
print("generating crash report")
|
||||
report = self.make_apport_report(
|
||||
ErrorReportKind.UI, "Installer UI", wait=True)
|
||||
print("report saved to {}".format(report.path))
|
||||
raise
|
||||
|
||||
def _network_change(self):
|
||||
self.signal.emit_signal('snapd-network-change')
|
||||
|
||||
|
|
Loading…
Reference in New Issue