From 24199f28b6f0804a3acc71f4cde38548a0bfa98c Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Sat, 18 Feb 2023 00:49:55 +0000 Subject: [PATCH] import rteval-3.5-4.el8 --- ...l-Catch-failures-in-python-dmidecode.patch | 54 +++++++++++++++++++ SPECS/rteval.spec | 9 +++- 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 SOURCES/rteval-Catch-failures-in-python-dmidecode.patch diff --git a/SOURCES/rteval-Catch-failures-in-python-dmidecode.patch b/SOURCES/rteval-Catch-failures-in-python-dmidecode.patch new file mode 100644 index 0000000..04d2bb3 --- /dev/null +++ b/SOURCES/rteval-Catch-failures-in-python-dmidecode.patch @@ -0,0 +1,54 @@ +From eacf0f1e55fa0e7217133172808bfef2c59242fb Mon Sep 17 00:00:00 2001 +From: John Kacur +Date: Thu, 2 Feb 2023 00:47:31 -0500 +Subject: [PATCH] rteval: Catch failures in python-dmidecode + +python-dmidecode can generate incorrect xml, +namely Attribute unit redefined + +Although useful, the dmidecode is not critical to rteval reporting. + +Therefore catch this, and first see if we can at least query the bios. +If that works report the bios instead of all, and if that +doesn't work, just continue without the dmidecode report. + +Signed-off-by: John Kacur +--- + rteval/sysinfo/dmi.py | 14 +++++++++++++- + 1 file changed, 13 insertions(+), 1 deletion(-) + +diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py +index 83f347623b58..89a7faae06b1 100644 +--- a/rteval/sysinfo/dmi.py ++++ b/rteval/sysinfo/dmi.py +@@ -79,6 +79,7 @@ class DMIinfo: + + def __init__(self, logger=None): + self.__version = '0.6' ++ self._log = logger + + if not dmidecode_avail: + logger.log(Log.DEBUG, "DMI info unavailable, ignoring DMI tables") +@@ -115,7 +116,18 @@ class DMIinfo: + rep_n.newProp("not_available", "1") + else: + self.__dmixml.SetResultType(dmidecode.DMIXML_DOC) +- dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all')) ++ try: ++ dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all')) ++ except Exception as ex1: ++ self._log.log(Log.DEBUG, f'** EXCEPTION {str(ex1)}, will query BIOS only') ++ try: ++ # If we can't query 'all', at least query 'bios' ++ dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('bios')) ++ except Exception as ex2: ++ rep_n.addContent("No DMI tables available") ++ rep_n.newProp("not_available", "1") ++ self._log.log(Log.DEBUG, f'** EXCEPTION {str(ex2)}, dmi info will not be reported') ++ return rep_n + resdoc = self.__xsltparser(dmiqry) + dmi_n = xmlout.convert_lxml_to_libxml2_nodes(resdoc.getroot()) + rep_n.addChild(dmi_n) +-- +2.39.0 + diff --git a/SPECS/rteval.spec b/SPECS/rteval.spec index 6f99887..780df22 100644 --- a/SPECS/rteval.spec +++ b/SPECS/rteval.spec @@ -1,6 +1,6 @@ Name: rteval Version: 3.5 -Release: 3%{?dist} +Release: 4%{?dist} Summary: Utility to evaluate system suitability for RT Linux Group: Development/Tools @@ -36,6 +36,7 @@ Obsoletes: rteval-common <= 3.1 Patch1: rteval-Replace-python-ethtool-with-inline-code.patch Patch2: Fix-DMI-WARNING-when-not-running-as-root.patch Patch3: rteval-Don-t-attempt-to-get-DMIinfo-if-there-are-dmi.patch +Patch4: rteval-Catch-failures-in-python-dmidecode.patch %description The rteval script is a utility for measuring various aspects of @@ -51,6 +52,7 @@ to the screen. %patch1 -p1 %patch2 -p1 %patch3 -p1 +%patch4 -p1 %build %{__python3} setup.py build @@ -84,6 +86,11 @@ to the screen. %{python3_sitelib}/rteval/__pycache__/* %changelog +* Wed Feb 08 2023 John Kacur - 3.5-4 +- Add check to catch python-dmidecode if it fails +Resolves: rhbz#2168373 +jiraProject == RHELPLAN-148048 + * Thu Oct 27 2022 John Kacur - 3.5-3 - Fix "DMI WARNING" when not running as root - Don't attempt to get DMI info if dmidecode returns warnings