rteval: Fix "DMI WARNING" when not running as root
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
Signed-off-by John Kacur <[email protected]>
--- rteval/sysinfo/__init__.py | 6 ++--- rteval/sysinfo/dmi.py | 45 +++++++++++++++++++------------------- 2 files changed, 26 insertions(+), 25 deletions(-)
rteval/sysinfo/__init__.py +3 -3
@@ -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