Open jasonbrianhall opened 2 years ago
$ cat stig.py import stig_parser
import os
with open("xccdf.xml", "r") as fh: raw_file = fh.read()
json_results = stig_parser.convert_xccdf(raw_file)
$ python stig.py Traceback (most recent call last): File "/home/jbhall/software_build/xccdf/stig.py", line 10, in json_results = stig_parser.convert_xccdf(raw_file) File "/home/jbhall/aws3/lib/python3.9/site-packages/stig_parser/stig_parser.py", line 76, in convert_xccdf if isinstance(CONTENT_DICT['Benchmark']['plain-text'], list): KeyError: 'plain-text'
I'm also experiencing this with an XCCDF XML file created from oscap (no podman). The XML file I have is in XCCDF version 1.2 format.
$ cat stig.py import stig_parser
LOAD XML FILE (OPTIONAL)
import os
with open("xccdf.xml", "r") as fh: raw_file = fh.read()
PARSE XCCDF(XML) to JSON
json_results = stig_parser.convert_xccdf(raw_file)
$ python stig.py Traceback (most recent call last): File "/home/jbhall/software_build/xccdf/stig.py", line 10, in
json_results = stig_parser.convert_xccdf(raw_file)
File "/home/jbhall/aws3/lib/python3.9/site-packages/stig_parser/stig_parser.py", line 76, in convert_xccdf
if isinstance(CONTENT_DICT['Benchmark']['plain-text'], list):
KeyError: 'plain-text'