Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid duplicate loading of component files #11195

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions build-scripts/compile_all.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def main():

loader = ssg.build_yaml.BuildLoader(
None, env_yaml, product_cpes, args.sce_metadata, args.stig_references)
loader.load_components()
load_benchmark_source_data_from_directory_tree(loader, env_yaml, product_yaml)

project_root_abspath = os.path.abspath(args.project_root)
Expand Down
7 changes: 3 additions & 4 deletions ssg/build_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -1331,19 +1331,18 @@ def __init__(
if stig_reference_path:
self.stig_references = ssg.build_stig.map_versions_to_rule_ids(stig_reference_path)
self.components_dir = None
self.rule_to_components = self._load_components()
self.rule_to_components = None

def _load_components(self):
def load_components(self):
if "components_root" not in self.env_yaml:
return None
product_dir = self.env_yaml["product_dir"]
components_root = self.env_yaml["components_root"]
self.components_dir = os.path.abspath(
os.path.join(product_dir, components_root))
components = ssg.components.load(self.components_dir)
rule_to_components = ssg.components.rule_component_mapping(
self.rule_to_components = ssg.components.rule_component_mapping(
components)
return rule_to_components

def _process_values(self):
for value_yaml in self.value_files:
Expand Down
Loading