rteval/rteval-sysstat-Convert-base64-data-to-text-before-wr.patch
John Kacur 5867fda300 Rename some patches
Add timerlat tracing
Add Fix-aNone being pass to cyclictest
Resolves: RHEL-35462

Signed-off-by: John Kacur <jkacur@redhat.com>
2024-06-24 12:35:48 -04:00

66 lines
3.1 KiB
Diff

From ca90d5aa7ae2ff6dac124c710fceadae028b5f4a Mon Sep 17 00:00:00 2001
From: Crystal Wood <crwood@redhat.com>
Date: Thu, 20 Jun 2024 21:18:05 -0500
Subject: [PATCH 2/4] rteval: sysstat: Convert base64 data to text before
wrapping
As of Python 3, b64encode() returns data, not a string, causing this:
Traceback (most recent call last):
File "/home/crwood/git/rteval/./rteval-cmd", line 413, in <module>
ec = rteval.Measure()
^^^^^^^^^^^^^^^^
File "/home/crwood/git/rteval/rteval/__init__.py", line 246, in Measure
self._report(measure_start, self.__rtevcfg.xslt_report)
File "/home/crwood/git/rteval/rteval/rtevalReport.py", line 63, in _report
self.__xmlreport.AppendXMLnodes(self._measuremods.MakeReport())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/crwood/git/rteval/rteval/modules/measurement/__init__.py", line 190, in MakeReport
mprep_n = mp.MakeReport()
^^^^^^^^^^^^^^^
File "/home/crwood/git/rteval/rteval/modules/measurement/__init__.py", line 62, in MakeReport
rep_n = RtEvalModules.MakeReport(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/crwood/git/rteval/rteval/modules/__init__.py", line 559, in MakeReport
modrep_n = mod.MakeReport()
^^^^^^^^^^^^^^^^
File "/home/crwood/git/rteval/rteval/modules/measurement/sysstat.py", line 83, in MakeReport
data_n = rep_n.newTextChild(None, 'data', "\n"+"\n".join(textwrap.wrap(data, 75))+"\n")
^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/textwrap.py", line 384, in wrap
return w.wrap(text)
^^^^^^^^^^^^
File "/usr/lib64/python3.12/textwrap.py", line 356, in wrap
chunks = self._split_chunks(text)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/textwrap.py", line 342, in _split_chunks
text = self._munge_whitespace(text)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib64/python3.12/textwrap.py", line 153, in _munge_whitespace
text = text.translate(self.unicode_whitespace_trans)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'dict'
Signed-off-by: Crystal Wood <crwood@redhat.com>
Signed-off-by: John Kacur <jkacur@redhat.com>
---
rteval/modules/measurement/sysstat.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/rteval/modules/measurement/sysstat.py b/rteval/modules/measurement/sysstat.py
index 57194a2b5f45..d4646c1646f4 100644
--- a/rteval/modules/measurement/sysstat.py
+++ b/rteval/modules/measurement/sysstat.py
@@ -79,7 +79,7 @@ class sysstat(rtevalModulePrototype):
fp = open(self.__datafile, "rb")
compr = bz2.BZ2Compressor(9)
cmpr = compr.compress(fp.read())
- data = base64.b64encode(cmpr + compr.flush())
+ data = base64.b64encode(cmpr + compr.flush()).decode('utf-8')
data_n = rep_n.newTextChild(None, 'data', "\n"+"\n".join(textwrap.wrap(data, 75))+"\n")
data_n.newProp('contents', 'sysstat/sar binary data')
data_n.newProp('encoding', 'base64')
--
2.45.2