From 580b015d05142913bc0117b121a61e797bd060ea Mon Sep 17 00:00:00 2001 From: pyth0n1c Date: Fri, 19 Jul 2024 11:04:17 -0700 Subject: [PATCH 1/2] 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. --- contentctl/actions/detection_testing/GitService.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/contentctl/actions/detection_testing/GitService.py b/contentctl/actions/detection_testing/GitService.py index 14e410cf..36c45cc2 100644 --- a/contentctl/actions/detection_testing/GitService.py +++ b/contentctl/actions/detection_testing/GitService.py @@ -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) From 331d4ffeab2588434bd63e616497adf18ba8323d Mon Sep 17 00:00:00 2001 From: pyth0n1c Date: Fri, 19 Jul 2024 11:04:45 -0700 Subject: [PATCH 2/2] bump patch version in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 817a3c0c..6b5dec71 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "contentctl" -version = "4.1.3" +version = "4.1.4" description = "Splunk Content Control Tool" authors = ["STRT "] license = "Apache 2.0"