diff --git a/insights/parsers/ibm_proc.py b/insights/parsers/ibm_proc.py index f59e1b92d6..56191e9856 100644 --- a/insights/parsers/ibm_proc.py +++ b/insights/parsers/ibm_proc.py @@ -55,9 +55,10 @@ class IBMFirmwareLevel(Parser): Typical content looks like:: - FW950.30 (VL950_092) + FW950.30 (VL950_092)\x00 Attributes: + raw (str): The RAW content of the `ibm,fw-vernum_encoded` file. firmware_level (str): The firmware level required by FLRT. Examples: @@ -72,9 +73,9 @@ def parse_content(self, content): if not content: raise SkipException("Empty output.") - _, fwl = content[0].split(None, 1) + self.raw = content[0] - if not fwl: + if "(" not in self.raw or ")" not in self.raw: raise SkipException("Nothing to parse.") - self.firmware_level = fwl.strip('()') + self.firmware_level = self.raw[self.raw.index('(') + 1:self.raw.index(')')] diff --git a/insights/parsers/tests/test_ibm_proc.py b/insights/parsers/tests/test_ibm_proc.py index 1be5429721..2b095c3125 100644 --- a/insights/parsers/tests/test_ibm_proc.py +++ b/insights/parsers/tests/test_ibm_proc.py @@ -11,7 +11,11 @@ """.strip() PROC_IBM_FWL = """ -FW950.30 (VL950_092) +FW950.30 (VL950_092)\x00 +""".strip() + +PROC_IBM_FWL_NG = """ +FW950.30 VL950_092\x00 """.strip() @@ -31,6 +35,9 @@ def test_ibm_proc_empty(): with pytest.raises(SkipException): IBMFirmwareLevel(context_wrap('')) + with pytest.raises(SkipException): + IBMFirmwareLevel(context_wrap(PROC_IBM_FWL_NG)) + def test_ibm_proc_doc_examples(): env = {