Skip to content

Commit

Permalink
Revert "TODO (revert): temporarily disabling some v"
Browse files Browse the repository at this point in the history
This reverts commit b3c6948.
  • Loading branch information
cmcginley-splunk committed Nov 21, 2024
1 parent 4b79565 commit 57fe775
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -569,26 +569,25 @@ def model_post_init(self, __context: Any) -> None:
# 1 of the drilldowns contains the string Drilldown.SEARCH_PLACEHOLDER.
# This is presently a requirement when 1 or more drilldowns are added to a detection.
# Note that this is only required for production searches that are not hunting

# TODO (cmcginley): commenting out for testing
# if self.type == AnalyticsType.Hunting.value or self.status != DetectionStatus.production.value:
# #No additional check need to happen on the potential drilldowns.
# pass
# else:
# found_placeholder = False
# if len(self.drilldown_searches) < 2:
# raise ValueError(f"This detection is required to have 2 drilldown_searches, but only has [{len(self.drilldown_searches)}]")
# for drilldown in self.drilldown_searches:
# if DRILLDOWN_SEARCH_PLACEHOLDER in drilldown.search:
# found_placeholder = True
# if not found_placeholder:
# raise ValueError("Detection has one or more drilldown_searches, but none of them "
# f"contained '{DRILLDOWN_SEARCH_PLACEHOLDER}. This is a requirement "
# "if drilldown_searches are defined.'")

# # Update the search fields with the original search, if required
# for drilldown in self.drilldown_searches:
# drilldown.perform_search_substitutions(self)
if self.type == AnalyticsType.Hunting.value or self.status != DetectionStatus.production.value:
#No additional check need to happen on the potential drilldowns.
pass
else:
found_placeholder = False
if len(self.drilldown_searches) < 2:
raise ValueError(f"This detection is required to have 2 drilldown_searches, but only has [{len(self.drilldown_searches)}]")
for drilldown in self.drilldown_searches:
if DRILLDOWN_SEARCH_PLACEHOLDER in drilldown.search:
found_placeholder = True
if not found_placeholder:
raise ValueError("Detection has one or more drilldown_searches, but none of them "
f"contained '{DRILLDOWN_SEARCH_PLACEHOLDER}. This is a requirement "
"if drilldown_searches are defined.'")

# Update the search fields with the original search, if required
for drilldown in self.drilldown_searches:
drilldown.perform_search_substitutions(self)

#For experimental purposes, add the default drilldowns
#self.drilldown_searches.extend(Drilldown.constructDrilldownsFromDetection(self))
Expand Down
5 changes: 2 additions & 3 deletions contentctl/output/conf_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,8 @@ def writeDashboardFiles(config:build, dashboards:list[Dashboard])->set[pathlib.P
output_file_path = dashboard.getOutputFilepathRelativeToAppRoot(config)
# Check that the full output path does not exist so that we are not having an
# name collision with a file in app_template
# TODO (cmcginley): commenting out for testing
# if (config.getPackageDirectoryPath()/output_file_path).exists():
# raise FileExistsError(f"ERROR: Overwriting Dashboard File {output_file_path}. Does this file exist in {config.getAppTemplatePath()} AND {config.path/'dashboards'}?")
if (config.getPackageDirectoryPath()/output_file_path).exists():
raise FileExistsError(f"ERROR: Overwriting Dashboard File {output_file_path}. Does this file exist in {config.getAppTemplatePath()} AND {config.path/'dashboards'}?")

ConfWriter.writeXmlFileHeader(output_file_path, config)
dashboard.writeDashboardFile(ConfWriter.getJ2Environment(), config)
Expand Down

0 comments on commit 57fe775

Please sign in to comment.