Detect openSUSE distribution

Expand regex to detect and display the distribution name.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-04-16 17:31:43 +02:00
parent ff85bd35ac
commit 24489e2644
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57
2 changed files with 8 additions and 4 deletions

View File

@ -1044,7 +1044,7 @@ window.onerror = function (msg, url, lineNo, columnNo, errorObj) {
<tr>
<td>Distribution</td>
<td class="dist text--align-right text--align-right"></td>
<td>Guessed from the kernel version</td>
<td></td>
</tr>
<tr>
<td>Platform</td>

View File

@ -273,7 +273,7 @@ class BaseKernelConfig:
"Trigger process and kernel version": (
r"^CPU: \d+ PID: (?P<trigger_proc_pid>\d+) "
r"Comm: .* (Not tainted|Tainted:.*) "
r"(?P<kernel_version>\d[\w.-]+) #\d",
r"(?P<kernel_version>\d[\w.-]+) (?:#\d) (?P<distribution>\w+ \w+).+",
True,
),
# split caused by a limited number of iterations during converting PY regex into JS regex
@ -2975,7 +2975,7 @@ class OOMAnalyser:
"""
REC_KERNEL_VERSION = re.compile(
r"CPU: \d+ PID: \d+ Comm: .* (Not tainted|Tainted: [A-Z ]+) (?P<kernel_version>\d[\w.-]+) #.+"
r"CPU: \d+ PID: \d+ Comm: .* (Not tainted|Tainted: [A-Z ]+) (?P<kernel_version>\d[\w.-]+) (?:#\d) (?P<distribution>\w+ \w+).+"
)
"""RE to match the OOM line with kernel version"""
@ -3662,13 +3662,17 @@ class OOMAnalyser:
def _determinate_platform_and_distribution(self):
"""Determinate platform and distribution"""
kernel_version = self.oom_result.details.get("kernel_version", "")
distribution = self.oom_result.details.get("distribution", None)
if "x86_64" in kernel_version:
self.oom_result.details["platform"] = "x86 64bit"
else:
self.oom_result.details["platform"] = "unknown"
dist = "unknown"
if ".el7uek" in kernel_version:
if distribution is not None:
# this should work on openSUSE
dist = distribution
elif ".el7uek" in kernel_version:
dist = "Oracle Linux 7 (Unbreakable Enterprise Kernel)"
elif ".el7" in kernel_version:
dist = "RHEL 7/CentOS 7"