Skip to content

Commit 580b015

Browse files
committed
Fix bug which causes failure on mode:changes for modified .mlmodel files. Improve the error message generated when a file that does not end in csv, yml, or mlmodel has been changed in the lookups directory.
1 parent 861a475 commit 580b015

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

contentctl/actions/detection_testing/GitService.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,19 @@ def getChanges(self, target_branch:str)->List[Detection]:
111111
raise Exception(f"More than 1 Lookup reference the modified CSV file '{decoded_path}': {[l.file_path for l in matched ]}")
112112
else:
113113
updatedLookup = matched[0]
114+
elif decoded_path.suffix == ".mlmodel":
115+
# Detected a changed .mlmodel file. However, since we do not have testing for these detections at
116+
# this time, we will ignore this change.
117+
updatedLookup = None
118+
119+
114120
else:
115-
raise Exception(f"Error getting lookup object for file {str(decoded_path)}")
121+
raise Exception(f"Detected a changed file in the lookups/ directory '{str(decoded_path)}'.\n"
122+
"Only files ending in .csv, .yml, or .mlmodel are supported in this "
123+
"directory. This file must be removed from the lookups/ directory.")
116124

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

0 commit comments

Comments
 (0)