diff --git a/build-scripts/compose_ds.py b/build-scripts/compose_ds.py index cd3970ffa9e..6826be50c94 100755 --- a/build-scripts/compose_ds.py +++ b/build-scripts/compose_ds.py @@ -33,7 +33,8 @@ def mangle_path(path): # From the list generated by collect_sce_checks, extract the path to the check content, # and embed the script into the data stream -def embed_sce_checks_in_datastream(datastreamtree, checklists, sce_files, build_dir): +def embed_sce_checks_in_datastream(datastreamtree, checklists, checks, build_dir): + sce_files = collect_sce_checks(datastreamtree) for file in sce_files: path = os.path.join(build_dir, file) mangled_path = mangle_path(file) @@ -55,7 +56,7 @@ def embed_sce_checks_in_datastream(datastreamtree, checklists, sce_files, build_ # Create a component reference to map the checklist to the extended component component_ref_id = "scap_{}_cref_{}".format(ID_NS, mangled_path) component_ref = ET.SubElement( - checklists, '{%s}component-ref' % datastream_namespace, + checks, '{%s}component-ref' % datastream_namespace, attrib={ 'id': component_ref_id, ('{%s}href' % xlink_namespace): '#' + component_id @@ -259,8 +260,7 @@ def compose_ds( add_component(ds_collection, checks, ocil_file_name) add_component(ds_collection, checks, cpe_oval_file_name) if sce_enabled: - sce_check_files = collect_sce_checks(ds_collection) - embed_sce_checks_in_datastream(ds_collection, checklists, sce_check_files, build_dir) + embed_sce_checks_in_datastream(ds_collection, checklists, checks, build_dir) if hasattr(ET, "indent"): ET.indent(ds_collection, space=" ", level=0) diff --git a/tests/test_ds_sce.py b/tests/test_ds_sce.py index d6c25cfa70a..fcf908051d6 100644 --- a/tests/test_ds_sce.py +++ b/tests/test_ds_sce.py @@ -11,7 +11,7 @@ def verify_file(ds, catalog_uris, file, build_dir): component_ref = ds.find(str.format( - ".//{{{ds_ns}}}checklists/{{{ds_ns}}}component-ref[@id='{cid}']", + ".//{{{ds_ns}}}checks/{{{ds_ns}}}component-ref[@id='{cid}']", ds_ns=datastream_namespace, cid=catalog_uris[file] ))