Skip to content

Commit

Permalink
Merge pull request #199 from splunk/fix_mlmodel_changes_bug
Browse files Browse the repository at this point in the history
Fix mlmodel changes bug
  • Loading branch information
patel-bhavin authored Jul 23, 2024
2 parents 596f2c1 + 57f6238 commit 3c7df89
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions contentctl/actions/detection_testing/GitService.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,19 @@ def getChanges(self, target_branch:str)->List[Detection]:
raise Exception(f"More than 1 Lookup reference the modified CSV file '{decoded_path}': {[l.file_path for l in matched ]}")
else:
updatedLookup = matched[0]
elif decoded_path.suffix == ".mlmodel":
# Detected a changed .mlmodel file. However, since we do not have testing for these detections at
# this time, we will ignore this change.
updatedLookup = None


else:
raise Exception(f"Error getting lookup object for file {str(decoded_path)}")
raise Exception(f"Detected a changed file in the lookups/ directory '{str(decoded_path)}'.\n"
"Only files ending in .csv, .yml, or .mlmodel are supported in this "
"directory. This file must be removed from the lookups/ directory.")

if updatedLookup not in updated_lookups:
# It is possible that both th CSV and YML have been modified for the same lookup,
if updatedLookup is not None and updatedLookup not in updated_lookups:
# It is possible that both the CSV and YML have been modified for the same lookup,
# and we do not want to add it twice.
updated_lookups.append(updatedLookup)

Expand Down

0 comments on commit 3c7df89

Please sign in to comment.