Merge pull request #1851 from Chris-Peterson444/update-apport-logs-FR-5444
Update apport reporting
This commit is contained in:
commit
560b0b24d1
|
@ -62,7 +62,7 @@ validate () {
|
|||
# not to do that.
|
||||
# If we run an autoinstall that customizes the security section as part
|
||||
# of the test-suite, we will need to adapt this test.
|
||||
python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/subiquity-curtin-apt.conf \
|
||||
python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/curtin-install/subiquity-curtin-apt.conf \
|
||||
apt.security[0].uri='"http://security.ubuntu.com/ubuntu/"' \
|
||||
apt.security[0].arches='["amd64", "i386"]' \
|
||||
apt.security[1].uri='"http://ports.ubuntu.com/ubuntu-ports"'
|
||||
|
@ -259,7 +259,7 @@ LANG=C.UTF-8 timeout --foreground 60 \
|
|||
--kernel-cmdline autoinstall \
|
||||
--source-catalog examples/sources/install.yaml
|
||||
validate
|
||||
python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/subiquity-curtin-apt.conf \
|
||||
python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/curtin-install/subiquity-curtin-apt.conf \
|
||||
apt.disable_components='[non-free, restricted]' \
|
||||
apt.preferences[0].pin-priority=200 \
|
||||
apt.preferences[0].pin='"origin *ubuntu.com*"' \
|
||||
|
|
|
@ -194,9 +194,13 @@ def main():
|
|||
logfiles = setup_logger(dir=logdir, base="subiquity-server")
|
||||
|
||||
logger = logging.getLogger("subiquity")
|
||||
version = os.environ.get("SNAP_REVISION", "unknown")
|
||||
revision = os.environ.get("SNAP_REVISION", "unknown")
|
||||
version = os.environ.get("SNAP_VERSION", "unknown")
|
||||
snap = os.environ.get("SNAP", "unknown")
|
||||
logger.info(f"Starting Subiquity server revision {version} of snap {snap}")
|
||||
logger.info(
|
||||
f"Starting Subiquity server revision {revision} of snap {snap} "
|
||||
f"of version {version}"
|
||||
)
|
||||
logger.info(f"Arguments passed: {sys.argv}")
|
||||
logger.debug(f"Kernel commandline: {opts.kernel_cmdline}")
|
||||
logger.debug(f"Environment: {os.environ}")
|
||||
|
|
|
@ -146,8 +146,12 @@ def main():
|
|||
|
||||
async def run_with_loop():
|
||||
subiquity_interface = SubiquityClient(opts)
|
||||
subiquity_interface.note_file_for_apport("InstallerLog", logfiles["debug"])
|
||||
subiquity_interface.note_file_for_apport("InstallerLogInfo", logfiles["info"])
|
||||
subiquity_interface.note_file_for_apport(
|
||||
"InstallerClientLog", logfiles["debug"]
|
||||
)
|
||||
subiquity_interface.note_file_for_apport(
|
||||
"InstallerClientLogInfo", logfiles["info"]
|
||||
)
|
||||
await subiquity_interface.run()
|
||||
|
||||
asyncio.run(run_with_loop())
|
||||
|
|
|
@ -34,6 +34,7 @@ import urwid
|
|||
|
||||
from subiquity.common.types import ErrorReportKind, ErrorReportRef, ErrorReportState
|
||||
from subiquitycore.async_helpers import run_in_thread, schedule_task
|
||||
from subiquitycore.file_util import write_file
|
||||
|
||||
log = logging.getLogger("subiquity.common.errorreport")
|
||||
|
||||
|
@ -132,7 +133,9 @@ class ErrorReport(metaclass=urwid.MetaSignals):
|
|||
if not self.reporter.dry_run:
|
||||
self.pr.add_hooks_info(None)
|
||||
apport.hookutils.attach_hardware(self.pr)
|
||||
self.pr["Syslog"] = apport.hookutils.recent_syslog(re.compile("."))
|
||||
self.pr["InstallerJournal"] = apport.hookutils.recent_syslog(
|
||||
re.compile(".")
|
||||
)
|
||||
snap_name = os.environ.get("SNAP_NAME", "")
|
||||
if snap_name != "":
|
||||
self.add_tags([snap_name])
|
||||
|
@ -343,6 +346,7 @@ class ErrorReporter(object):
|
|||
def __init__(self, context, dry_run, root, client=None):
|
||||
self.context = context
|
||||
self.dry_run = dry_run
|
||||
self.root = root
|
||||
self.crash_directory = os.path.join(root, "var/crash")
|
||||
self.client = client
|
||||
|
||||
|
@ -408,6 +412,11 @@ class ErrorReporter(object):
|
|||
report.pr["Title"] = "{} crashed with {}".format(thing, type(exc).__name__)
|
||||
tb = traceback.TracebackException.from_exception(exc)
|
||||
report.pr["Traceback"] = "".join(tb.format())
|
||||
# Write out traceback for apport consumption
|
||||
traceback_log = os.path.join(
|
||||
self.root, "var/log/installer", "subiquity-traceback.txt"
|
||||
)
|
||||
write_file(traceback_log, "".join(tb.format()))
|
||||
self._reports_by_exception[exc] = report
|
||||
else:
|
||||
report.pr["Title"] = thing
|
||||
|
|
|
@ -148,7 +148,7 @@ class AptConfigurer:
|
|||
self.configured_tree = await self.mounter.setup_overlay([self.source_path])
|
||||
|
||||
config_location = os.path.join(
|
||||
self.app.root, "var/log/installer/subiquity-curtin-apt.conf"
|
||||
self.app.root, "var/log/installer/curtin-install/subiquity-curtin-apt.conf"
|
||||
)
|
||||
generate_config_yaml(config_location, self.apt_config(final))
|
||||
self.app.note_data_for_apport("CurtinAptConfig", config_location)
|
||||
|
|
|
@ -155,8 +155,12 @@ def main():
|
|||
|
||||
async def run_with_loop():
|
||||
subiquity_interface = SystemSetupClient(opts)
|
||||
subiquity_interface.note_file_for_apport("InstallerLog", logfiles["debug"])
|
||||
subiquity_interface.note_file_for_apport("InstallerLogInfo", logfiles["info"])
|
||||
subiquity_interface.note_file_for_apport(
|
||||
"InstallerClientLog", logfiles["debug"]
|
||||
)
|
||||
subiquity_interface.note_file_for_apport(
|
||||
"InstallerClientLogInfo", logfiles["info"]
|
||||
)
|
||||
await subiquity_interface.run()
|
||||
|
||||
asyncio.run(run_with_loop())
|
||||
|
|
Loading…
Reference in New Issue