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.
|
# not to do that.
|
||||||
# If we run an autoinstall that customizes the security section as part
|
# If we run an autoinstall that customizes the security section as part
|
||||||
# of the test-suite, we will need to adapt this test.
|
# 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].uri='"http://security.ubuntu.com/ubuntu/"' \
|
||||||
apt.security[0].arches='["amd64", "i386"]' \
|
apt.security[0].arches='["amd64", "i386"]' \
|
||||||
apt.security[1].uri='"http://ports.ubuntu.com/ubuntu-ports"'
|
apt.security[1].uri='"http://ports.ubuntu.com/ubuntu-ports"'
|
||||||
|
@ -259,7 +259,7 @@ LANG=C.UTF-8 timeout --foreground 60 \
|
||||||
--kernel-cmdline autoinstall \
|
--kernel-cmdline autoinstall \
|
||||||
--source-catalog examples/sources/install.yaml
|
--source-catalog examples/sources/install.yaml
|
||||||
validate
|
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.disable_components='[non-free, restricted]' \
|
||||||
apt.preferences[0].pin-priority=200 \
|
apt.preferences[0].pin-priority=200 \
|
||||||
apt.preferences[0].pin='"origin *ubuntu.com*"' \
|
apt.preferences[0].pin='"origin *ubuntu.com*"' \
|
||||||
|
|
|
@ -194,9 +194,13 @@ def main():
|
||||||
logfiles = setup_logger(dir=logdir, base="subiquity-server")
|
logfiles = setup_logger(dir=logdir, base="subiquity-server")
|
||||||
|
|
||||||
logger = logging.getLogger("subiquity")
|
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")
|
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.info(f"Arguments passed: {sys.argv}")
|
||||||
logger.debug(f"Kernel commandline: {opts.kernel_cmdline}")
|
logger.debug(f"Kernel commandline: {opts.kernel_cmdline}")
|
||||||
logger.debug(f"Environment: {os.environ}")
|
logger.debug(f"Environment: {os.environ}")
|
||||||
|
|
|
@ -146,8 +146,12 @@ def main():
|
||||||
|
|
||||||
async def run_with_loop():
|
async def run_with_loop():
|
||||||
subiquity_interface = SubiquityClient(opts)
|
subiquity_interface = SubiquityClient(opts)
|
||||||
subiquity_interface.note_file_for_apport("InstallerLog", logfiles["debug"])
|
subiquity_interface.note_file_for_apport(
|
||||||
subiquity_interface.note_file_for_apport("InstallerLogInfo", logfiles["info"])
|
"InstallerClientLog", logfiles["debug"]
|
||||||
|
)
|
||||||
|
subiquity_interface.note_file_for_apport(
|
||||||
|
"InstallerClientLogInfo", logfiles["info"]
|
||||||
|
)
|
||||||
await subiquity_interface.run()
|
await subiquity_interface.run()
|
||||||
|
|
||||||
asyncio.run(run_with_loop())
|
asyncio.run(run_with_loop())
|
||||||
|
|
|
@ -34,6 +34,7 @@ import urwid
|
||||||
|
|
||||||
from subiquity.common.types import ErrorReportKind, ErrorReportRef, ErrorReportState
|
from subiquity.common.types import ErrorReportKind, ErrorReportRef, ErrorReportState
|
||||||
from subiquitycore.async_helpers import run_in_thread, schedule_task
|
from subiquitycore.async_helpers import run_in_thread, schedule_task
|
||||||
|
from subiquitycore.file_util import write_file
|
||||||
|
|
||||||
log = logging.getLogger("subiquity.common.errorreport")
|
log = logging.getLogger("subiquity.common.errorreport")
|
||||||
|
|
||||||
|
@ -132,7 +133,9 @@ class ErrorReport(metaclass=urwid.MetaSignals):
|
||||||
if not self.reporter.dry_run:
|
if not self.reporter.dry_run:
|
||||||
self.pr.add_hooks_info(None)
|
self.pr.add_hooks_info(None)
|
||||||
apport.hookutils.attach_hardware(self.pr)
|
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", "")
|
snap_name = os.environ.get("SNAP_NAME", "")
|
||||||
if snap_name != "":
|
if snap_name != "":
|
||||||
self.add_tags([snap_name])
|
self.add_tags([snap_name])
|
||||||
|
@ -343,6 +346,7 @@ class ErrorReporter(object):
|
||||||
def __init__(self, context, dry_run, root, client=None):
|
def __init__(self, context, dry_run, root, client=None):
|
||||||
self.context = context
|
self.context = context
|
||||||
self.dry_run = dry_run
|
self.dry_run = dry_run
|
||||||
|
self.root = root
|
||||||
self.crash_directory = os.path.join(root, "var/crash")
|
self.crash_directory = os.path.join(root, "var/crash")
|
||||||
self.client = client
|
self.client = client
|
||||||
|
|
||||||
|
@ -408,6 +412,11 @@ class ErrorReporter(object):
|
||||||
report.pr["Title"] = "{} crashed with {}".format(thing, type(exc).__name__)
|
report.pr["Title"] = "{} crashed with {}".format(thing, type(exc).__name__)
|
||||||
tb = traceback.TracebackException.from_exception(exc)
|
tb = traceback.TracebackException.from_exception(exc)
|
||||||
report.pr["Traceback"] = "".join(tb.format())
|
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
|
self._reports_by_exception[exc] = report
|
||||||
else:
|
else:
|
||||||
report.pr["Title"] = thing
|
report.pr["Title"] = thing
|
||||||
|
|
|
@ -148,7 +148,7 @@ class AptConfigurer:
|
||||||
self.configured_tree = await self.mounter.setup_overlay([self.source_path])
|
self.configured_tree = await self.mounter.setup_overlay([self.source_path])
|
||||||
|
|
||||||
config_location = os.path.join(
|
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))
|
generate_config_yaml(config_location, self.apt_config(final))
|
||||||
self.app.note_data_for_apport("CurtinAptConfig", config_location)
|
self.app.note_data_for_apport("CurtinAptConfig", config_location)
|
||||||
|
|
|
@ -155,8 +155,12 @@ def main():
|
||||||
|
|
||||||
async def run_with_loop():
|
async def run_with_loop():
|
||||||
subiquity_interface = SystemSetupClient(opts)
|
subiquity_interface = SystemSetupClient(opts)
|
||||||
subiquity_interface.note_file_for_apport("InstallerLog", logfiles["debug"])
|
subiquity_interface.note_file_for_apport(
|
||||||
subiquity_interface.note_file_for_apport("InstallerLogInfo", logfiles["info"])
|
"InstallerClientLog", logfiles["debug"]
|
||||||
|
)
|
||||||
|
subiquity_interface.note_file_for_apport(
|
||||||
|
"InstallerClientLogInfo", logfiles["info"]
|
||||||
|
)
|
||||||
await subiquity_interface.run()
|
await subiquity_interface.run()
|
||||||
|
|
||||||
asyncio.run(run_with_loop())
|
asyncio.run(run_with_loop())
|
||||||
|
|
Loading…
Reference in New Issue