Skip to content

Commit

Permalink
ensure that before profile is output as XCCDF, it does not include an…
Browse files Browse the repository at this point in the history
…y unwanted components
  • Loading branch information
vojtapolasek committed Apr 11, 2024
1 parent 8e328a5 commit b628302
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ssg/build_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,12 @@ def _add_cpe_xml(self, root, cpe_platforms_to_not_include, product_cpes=None):
plat = ET.SubElement(root, "{%s}platform" % XCCDF12_NS)
plat.set("idref", cpe_name)

def _add_profiles_xml(self, root, profiles_to_not_include):
def _add_profiles_xml(self, root, components_to_not_include):
profiles_to_not_include = components_to_not_include.get("profiles", set())
for profile in self.profiles:
if profile.id_ in profiles_to_not_include:
continue
profile.remove_components_not_included(components_to_not_include)
root.append(profile.to_xml_element())

def _add_values_xml(self, root):
Expand Down Expand Up @@ -497,7 +499,7 @@ def to_xml_element(self, env_yaml=None, product_cpes=None, components_to_not_inc
contributors_file = os.path.join(os.path.dirname(__file__), "../Contributors.xml")
add_benchmark_metadata(root, contributors_file)

self._add_profiles_xml(root, components_to_not_include.get("profiles", set()))
self._add_profiles_xml(root, components_to_not_include)
self._add_values_xml(root)
self._add_groups_xml(root, components_to_not_include, env_yaml)
self._add_rules_xml(root, components_to_not_include.get("rules", set()), env_yaml,)
Expand Down

0 comments on commit b628302

Please sign in to comment.