From 2d33f1890869a17d332a4732cddd97684f833164 Mon Sep 17 00:00:00 2001 From: Mikhail Sandakov Date: Tue, 29 Oct 2024 14:52:55 +0200 Subject: [PATCH] Add support for retrieving kernel modules on Debian-based systems --- pleskdistup/common/src/feedback.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/pleskdistup/common/src/feedback.py b/pleskdistup/common/src/feedback.py index b1cff2c..fdfcb37 100644 --- a/pleskdistup/common/src/feedback.py +++ b/pleskdistup/common/src/feedback.py @@ -5,7 +5,7 @@ import typing import zipfile -from . import dist, plesk +from . import dist, log, plesk class Feedback(): @@ -153,8 +153,19 @@ def collect_plesk_version(out_file_path: str = "plesk_version.txt") -> typing.Li def collect_kernel_modules(out_file_path: str = "kernel_modules.txt") -> typing.List[str]: + possible_lsmod_paths: typing.List[str] = ["/usr/sbin/lsmod", "/sbin/lsmod"] + lsmod_utility: typing.Optional[str] = None + for lsmod_path in possible_lsmod_paths: + if os.path.exists(lsmod_path): + lsmod_utility = lsmod_path + break + + if lsmod_utility is None: + log.warn("lsmod utility not found, skipping kernel modules collection") + return [] + _collect_command_output( - ["/usr/sbin/lsmod"], + [lsmod_utility], out_file_path, "Getting kernel modules (called as {args}) failed: {ex}\n", )