From 57823cafb79d50f665aa0912e6bd7591d0575d23 Mon Sep 17 00:00:00 2001 From: Adam Kankovsky Date: Thu, 7 Nov 2024 10:51:34 +0100 Subject: [PATCH] Add config file for custom ignored_simple_tests --- script-pre-install.sh | 7 +++++++ scripts/launcher/lib/log_monitor/log_handler.py | 14 ++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/script-pre-install.sh b/script-pre-install.sh index d71d13b6..b1bd385b 100755 --- a/script-pre-install.sh +++ b/script-pre-install.sh @@ -24,6 +24,13 @@ TESTTYPE="ksscript" . ${KSTESTDIR}/functions.sh +# Define the path to the config file (must match the path in log_handler.py) +CONFIG_FILE_PATH="/tmp/ignored_simple_tests.conf" + +# Write the messages to ignore into the config file +# In this example, we're adding "Traceback" to be ignored +echo "Traceback" > "${CONFIG_FILE_PATH}" + validate() { local disksdir=$1 local status=0 diff --git a/scripts/launcher/lib/log_monitor/log_handler.py b/scripts/launcher/lib/log_monitor/log_handler.py index 1520bdc1..8d95fcc9 100644 --- a/scripts/launcher/lib/log_monitor/log_handler.py +++ b/scripts/launcher/lib/log_monitor/log_handler.py @@ -17,6 +17,8 @@ # # Red Hat Author(s): Vendula Poncova # +import os + from pylorax.monitor import LogRequestHandler @@ -42,6 +44,18 @@ class VirtualLogRequestHandler(LogRequestHandler): "Call Trace:" ] + # Path to the config file + CONFIG_FILE_PATH = '/tmp/ignored_simple_tests.conf' + + if os.path.isfile(CONFIG_FILE_PATH): + with open(CONFIG_FILE_PATH, 'r') as config_file: + extra_ignored_tests = [line.strip() for line in config_file if line.strip()] + # Extend the ignored_simple_tests list + ignored_simple_tests.extend(extra_ignored_tests) + + # Remove the config file after reading + os.remove(CONFIG_FILE_PATH) + # Specify error lines you want to add on top # of the default ones contained in Lorax simple_tests = LogRequestHandler.simple_tests + [