Skip to content

Commit

Permalink
Improve XCCDF output format
Browse files Browse the repository at this point in the history
Format output with 2 spaces and add XML header when building the
ssg-$product-xccdf.xml.
  • Loading branch information
jan-cerny committed Mar 1, 2024
1 parent 66353c0 commit cdd25bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion build-scripts/build_xccdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ def main():
ocil = loader.export_ocil_to_xml()
link_ocil(xccdftree, checks, args.ocil, ocil)

ssg.xml.ElementTree.ElementTree(xccdftree).write(args.xccdf, encoding="utf-8")
ssg.xml.ElementTree.ElementTree(xccdftree).write(
args.xccdf, xml_declaration=True, encoding="utf-8")

if args.thin_ds_components_dir != "off":
if not os.path.exists(args.thin_ds_components_dir):
Expand Down
2 changes: 1 addition & 1 deletion ssg/build_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ def to_xml_element(self, env_yaml=None, product_cpes=None, components_to_not_inc
self._add_rules_xml(root, components_to_not_include.get("rules", set()), env_yaml,)

if hasattr(ET, "indent"):
ET.indent(root, space=" ", level=0)
ET.indent(root, space=" ", level=0)
return root

def to_file(self, file_name, env_yaml=None):
Expand Down

0 comments on commit cdd25bc

Please sign in to comment.