From 24489e2644d6c0bb8e6b3d84a565016bf138d3d8 Mon Sep 17 00:00:00 2001 From: Georg Pfuetzenreuter Date: Sun, 16 Apr 2023 17:31:43 +0200 Subject: [PATCH] Detect openSUSE distribution Expand regex to detect and display the distribution name. Signed-off-by: Georg Pfuetzenreuter --- OOMAnalyser.html | 2 +- OOMAnalyser.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/OOMAnalyser.html b/OOMAnalyser.html index a4da8b9..73cd344 100644 --- a/OOMAnalyser.html +++ b/OOMAnalyser.html @@ -1044,7 +1044,7 @@ window.onerror = function (msg, url, lineNo, columnNo, errorObj) { Distribution - Guessed from the kernel version + Platform diff --git a/OOMAnalyser.py b/OOMAnalyser.py index 876f2a5..5360f3d 100644 --- a/OOMAnalyser.py +++ b/OOMAnalyser.py @@ -273,7 +273,7 @@ class BaseKernelConfig: "Trigger process and kernel version": ( r"^CPU: \d+ PID: (?P\d+) " r"Comm: .* (Not tainted|Tainted:.*) " - r"(?P\d[\w.-]+) #\d", + r"(?P\d[\w.-]+) (?:#\d) (?P\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\d[\w.-]+) #.+" + r"CPU: \d+ PID: \d+ Comm: .* (Not tainted|Tainted: [A-Z ]+) (?P\d[\w.-]+) (?:#\d) (?P\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"