Skip to content

Commit 8411908

Browse files
authored
Merge pull request #398 from splunk/fix_runtime_csv_testing_error
Fix runtime csv testing error
2 parents 7e5d21d + 2995aff commit 8411908

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

contentctl/actions/detection_testing/GitService.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from contentctl.objects.config import All, Changes, Selected, test_common
1515
from contentctl.objects.data_source import DataSource
1616
from contentctl.objects.detection import Detection
17-
from contentctl.objects.lookup import CSVLookup, Lookup
17+
from contentctl.objects.lookup import CSVLookup, Lookup, RuntimeCSV
1818
from contentctl.objects.macro import Macro
1919
from contentctl.objects.security_content_object import SecurityContentObject
2020

@@ -148,6 +148,9 @@ def getChanges(self, target_branch: str) -> List[Detection]:
148148
matched = list(
149149
filter(
150150
lambda x: isinstance(x, CSVLookup)
151+
and not isinstance(
152+
x, RuntimeCSV
153+
) # RuntimeCSV is not used directly by any content
151154
and x.filename == decoded_path,
152155
self.director.lookups,
153156
)

contentctl/actions/validate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def ensure_no_orphaned_files_in_lookups(
5454
"""
5555
lookupsDirectory = repo_path / "lookups"
5656

57-
# Get all of the files referneced by Lookups
57+
# Get all of the files referenced by Lookups
5858
usedLookupFiles: list[pathlib.Path] = [
5959
lookup.filename
6060
for lookup in director_output_dto.lookups

contentctl/objects/abstract_security_content_objects/detection_abstract.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def serialize_model(self):
547547
{
548548
"name": lookup.name,
549549
"description": lookup.description,
550-
"filename": lookup.filename.name,
550+
"filename": lookup.filename.name, # This does not cause an issue for RuntimeCSV type because they are not used by any detections
551551
"default_match": lookup.default_match,
552552
"case_sensitive_match": "true"
553553
if lookup.case_sensitive_match

contentctl/objects/lookup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ def filename(self) -> FilePath:
257257
"""
258258
if self.file_path is None:
259259
raise ValueError(
260-
f"Cannot get the filename of the lookup {self.lookup_type} because the YML file_path attribute is None"
260+
f"Cannot get the filename of the lookup {self.lookup_type} for content [{self.name}] because the YML file_path attribute is None"
261261
) # type: ignore
262262

263263
csv_file = self.file_path.parent / f"{self.file_path.stem}.{self.lookup_type}" # type: ignore

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[tool.poetry]
22
name = "contentctl"
33

4-
version = "5.3.0"
4+
version = "5.3.1"
55

66
description = "Splunk Content Control Tool"
77
authors = ["STRT <[email protected]>"]

0 commit comments

Comments
 (0)