[Merge] ~cpete/ubuntu/+source/apport:updated-subiquity-hook into ~ubuntu-core-dev/ubuntu/+source/apport:ubuntu/devel
Chris Peterson
mp+454563 at code.launchpad.net
Tue Nov 28 19:56:43 UTC 2023
Thanks for the review @dbungert. I will force push the with suggestions shortly. Let me know if you have better alternatives for the NetplanConfig names.
Diff comments:
> diff --git a/debian/package-hooks/subiquity.py b/debian/package-hooks/subiquity.py
> index 948a8e7..9eb09ce 100644
> --- a/debian/package-hooks/subiquity.py
> +++ b/debian/package-hooks/subiquity.py
> @@ -1,51 +1,84 @@
> -"""Send reports about subiquity to the correct Launchpad project."""
> +"""
> +Send reports about subiquity to the correct Launchpad project.
> +
> +"""
> import os
> +import re
>
> from apport import hookutils
>
>
> -def add_info(report, unused_ui):
> - """Send reports about subiquity to the correct Launchpad project."""
> - # TODO: read the version from the log file?
> - logfile = os.path.realpath("/var/log/installer/subiquity-debug.log")
> - revision = "unknown"
> - if os.path.exists(logfile):
> - hookutils.attach_file(report, "logfile", "InstallerLog")
> - with open(logfile, encoding="utf-8") as log_fp:
> - first_line = log_fp.readline()
> - marker = "Starting Subiquity revision"
> - if marker in first_line:
> - revision = first_line.split(marker)[1].strip()
> +def add_info(report, ui):
> + # Get subiquity version from log file
> + logfile = os.path.realpath("/var/log/installer/subiquity-server-debug.log")
> + log_contents = hookutils.read_file(logfile)
> + first_line = log_contents[0]
> + marker = "Starting Subiquity server revision"
> + if marker in first_line:
> + revision = first_line.split(marker)[1].strip()
> + else:
> + revision = "unknown"
> +
> report["Package"] = f"subiquity ({revision})"
> report["SourcePackage"] = "subiquity"
> # rewrite this section so the report goes to the project in Launchpad
> report[
> "CrashDB"
> - ] = """\
> -{
> - "impl": "launchpad",
> - "project": "subiquity",
> - "bug_pattern_url": "http://people.canonical.com/"
> - "~ubuntu-archive/bugpatterns/bugpatterns.xml",
> -}
> -"""
> + ] = """{
> + "impl": "launchpad",
> + "project": "subiquity",
> + "bug_pattern_url": "http://people.canonical.com/~ubuntu-archive/bugpatterns/bugpatterns.xml"
> + }"""
> +
> + # Check if the snap was updated
> + report["SnapUpdated"] = str(os.path.exists("/run/subiquity/updating"))
> +
> + # add in hardware information
> + hookutils.attach_hardware(report)
> +
> + # static subiquity generated logs
> + log_map = {
> + "InstallerServerLog": os.path.realpath(
ACK, this makes sense.
> + "/var/log/installer/subiquity-server-debug.log"
> + ),
> + "InstallerServerLogInfo": os.path.realpath(
> + "/var/log/installer/subiquity-server-info.log"
> + ),
> + "InstallerClientLog": os.path.realpath(
> + "/var/log/installer/subiquity-client-debug.log"
> + ),
> + "InstallerClientLogInfo": os.path.realpath(
> + "/var/log/installer/subiquity-client-info.log"
> + ),
> + "CurtinLog": "/var/log/installer/curtin-install.log",
> + "CurtinAptConfig": "var/log/installer/curtin-install/subiquity-curtin-apt.conf",
> + "CurtinCurthooksConfig": "/var/log/installer/curtin-install/subiquity-curthooks.conf",
> + "CurtinExtractConfig": "/var/log/installer/curtin-install/subiquity-extract.conf",
> + "CurtinInitialConfig": "/var/log/installer/curtin-install/subiquity-initial.conf",
> + "CurtinPartitioningConfig": "/var/log/installer/curtin-install/subiquity-partitioning.conf",
> + "ProbeData": "/var/log/installer/block/probe-data.json",
> + "Traceback": "/var/log/installer/subiquity-traceback.txt",
> + }
> +
> + # Add in netplan config - should be one or the other
> + netplan_log = "/etc/netplan/00-installer-config.yaml"
> + if not os.path.exists(netplan_log):
> + netplan_log = "/etc/netplan/00-snapd-config.yaml"
> + log_map["NetplanConfig"] = netplan_log
What would be sensible names to distinct them? "NetplanInstallerConfig" and "NetplanSnapdConfig" ?
> +
> + # Add journal log - from the installer if it exists or from the system
> + if "InstallerJournal" not in report:
> + installer_journal = "/var/log/installer/installer-journal.txt"
> + if os.path.exists(installer_journal):
> + log_map["InstallerJournal"] = installer_journal
> + else:
> + report["SystemJournal"] = hookutils.recent_syslog(re.compile("."))
> +
> + # Avoid adding udi log when symlink is incorrectly set
> + UdiLog = os.path.realpath("/var/log/installer/ubuntu_desktop_installer.log")
> + if os.path.exists(UdiLog):
> + log_map["UdiLog"] = UdiLog
>
> - # add in subiquity stuff
> - hookutils.attach_file_if_exists(
> - report, "/var/log/installer/subiquity-curtin-install.conf", "CurtinConfig"
> - )
> - hookutils.attach_file_if_exists(
> - report, "/var/log/installer/curtin-install.log", "CurtinLog"
> - )
> - hookutils.attach_file_if_exists(
> - report, "/var/log/installer/block/probe-data.json", "ProbeData"
> - )
> -
> - # collect desktop installer details if available
> - desktoplog = os.path.realpath("/var/log/installer/ubuntu_desktop_installer.log")
> - if os.path.exists(desktoplog):
> - hookutils.attach_file(report, desktoplog, "DesktopInstallerLog")
> - report.add_tags(["ubuntu-desktop-installer"])
> - snapdir = os.path.realpath("/snap/ubuntu-desktop-installer/current")
> - if os.path.exists(snapdir):
> - report["DesktopInstallerRev"] = os.path.basename(snapdir)
> + # Attach logs if they exist
> + for name, file in log_map.items():
> + hookutils.attach_file_if_exists(report, file, name)
--
https://code.launchpad.net/~cpete/ubuntu/+source/apport/+git/apport/+merge/454563
Your team Ubuntu Core Development Team is subscribed to branch ~ubuntu-core-dev/ubuntu/+source/apport:ubuntu/devel.
More information about the Ubuntu-reviews
mailing list