Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick committed Sep 25, 2023
1 parent ef75c23 commit be13985
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions contentctl/actions/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,25 @@ def execute(self, input_dto: GenerateInputDto) -> DirectorOutputDto:
return director_output_dto

elif input_dto.director_input_dto.product == SecurityContentProduct.SSA:
shutil.rmtree(input_dto.director_input_dto.config.build_ssa.output_path + '/srs/', ignore_errors=True)
shutil.rmtree(input_dto.director_input_dto.config.build_ssa.output_path + '/complex/', ignore_errors=True)
os.makedirs(input_dto.director_input_dto.config.build_ssa.output_path + '/complex/')
os.makedirs(input_dto.director_input_dto.config.build_ssa.output_path + '/srs/')
output_path = os.path.join(input_dto.director_input_dto.input_path, input_dto.director_input_dto.config.build_ssa.output_path)
shutil.rmtree(output_path + '/srs/', ignore_errors=True)
shutil.rmtree(output_path + '/complex/', ignore_errors=True)
os.makedirs(output_path + '/complex/')
os.makedirs(output_path + '/srs/')
ba_yml_output = BAYmlOutput()
ba_yml_output.writeObjects(director_output_dto.ssa_detections, input_dto.director_input_dto.config.build_ssa.output_path)
ba_yml_output.writeObjects(director_output_dto.ssa_detections, output_path)

elif input_dto.director_input_dto.product == SecurityContentProduct.API:
shutil.rmtree(input_dto.director_input_dto.config.build_api.output_path, ignore_errors=True)
os.makedirs(input_dto.director_input_dto.config.build_api.output_path)
output_path = os.path.join(input_dto.director_input_dto.input_path, input_dto.director_input_dto.config.build_api.output_path)
shutil.rmtree(output_path, ignore_errors=True)
os.makedirs(output_path)
api_json_output = ApiJsonOutput()
api_json_output.writeObjects(director_output_dto.detections, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.detections)
api_json_output.writeObjects(director_output_dto.stories, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.stories)
api_json_output.writeObjects(director_output_dto.baselines, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.baselines)
api_json_output.writeObjects(director_output_dto.investigations, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.investigations)
api_json_output.writeObjects(director_output_dto.lookups, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.lookups)
api_json_output.writeObjects(director_output_dto.macros, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.macros)
api_json_output.writeObjects(director_output_dto.deployments, input_dto.director_input_dto.config.build_api.output_path, SecurityContentType.deployments)
api_json_output.writeObjects(director_output_dto.detections, output_path, SecurityContentType.detections)
api_json_output.writeObjects(director_output_dto.stories, output_path, SecurityContentType.stories)
api_json_output.writeObjects(director_output_dto.baselines, output_path, SecurityContentType.baselines)
api_json_output.writeObjects(director_output_dto.investigations, output_path, SecurityContentType.investigations)
api_json_output.writeObjects(director_output_dto.lookups, output_path, SecurityContentType.lookups)
api_json_output.writeObjects(director_output_dto.macros, output_path, SecurityContentType.macros)
api_json_output.writeObjects(director_output_dto.deployments, output_path, SecurityContentType.deployments)

return director_output_dto

0 comments on commit be13985

Please sign in to comment.