Skip to contentSkip to conversation

rteval: Fix "DMI WARNING" when not running as root

PATCH New John Kacur 1 participant 1 message Aug 23, 2022

lore
Share & tools
lore

John Kacur

author
#0 lore raw

PATCH 1/1 rteval: Fix "DMI WARNING" when not running as root

In some cases it is not necessary to run as root, for example when running -Z (--summarize) to summarize an existing report.

In such cases we do not want to see the message:
** DMI WARNING ** Failed to open memory buffer (/dev/mem): Permission denied

The fix here surpresses that message.

In addition:
- the unused "config" option to DMIinfo.__init__ is removed
- A few strings are converted to f-strings
- "with" is used to open the xsltfile

---
 rteval/sysinfo/__init__.py |  6 ++---
 rteval/sysinfo/dmi.py      | 45 +++++++++++++++++++-------------------
 2 files changed, 26 insertions(+), 25 deletions(-)
rteval/sysinfo/__init__.py +3 -3
index 0436ebb350d9..a4359382f006 100644
@@ -42,7 +42,7 @@ class SystemInfo(KernelInfo, SystemServices, dmi.DMIinfo, CPUtopology,
         self.__logger = logger
         KernelInfo.__init__(self, logger=logger)
         SystemServices.__init__(self, logger=logger)
-        dmi.DMIinfo.__init__(self, config, logger=logger)
+        dmi.DMIinfo.__init__(self, logger=logger)
         CPUtopology.__init__(self)
         OSInfo.__init__(self, logger=logger)
         cmdlineInfo.__init__(self, logger=logger)
@@ -80,8 +80,8 @@ if __name__ == "__main__":
     cfg.installdir = "."
     si = SystemInfo(cfg, logger=l)
 
-    print("\tRunning on %s" % si.get_base_os())
-    print("\tNUMA nodes: %d" % si.mem_get_numa_nodes())
+    print(f"\tRunning on {si.get_base_os()}")
+    print(f"\tNUMA nodes: {si.mem_get_numa_nodes()}")
     print("\tMemory available: %03.2f %s\n" % si.mem_get_size())
 
     print("\tServices: ")
rteval/sysinfo/dmi.py +23 -22

103 lines not on this page · raw message

Signature · 1 line
2.37.2