Skip to content

Commit 8877ca0

Browse files
authored
Merge pull request #410 from splunk/catch_duplicate_analytic_stories_and_other_mapped_content
Catch duplicate analytic stories and other mapped content
2 parents 226c7f8 + 3192cc7 commit 8877ca0

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import pprint
1313
import uuid
1414
from abc import abstractmethod
15+
from collections import Counter
1516
from difflib import get_close_matches
1617
from functools import cached_property
1718
from typing import List, Optional, Tuple, Union
@@ -708,6 +709,15 @@ def mapNamesToSecurityContentObjects(
708709
"an error in the contentctl codebase which must be resolved."
709710
)
710711

712+
# Catch all for finding duplicates in mapped content
713+
if (
714+
len(duplicates := [name for name, count in Counter(v).items() if count > 1])
715+
> 0
716+
):
717+
raise ValueError(
718+
f"Duplicate {cls.__name__} ({duplicates}) found in list: {v}."
719+
)
720+
711721
mappedObjects: list[Self] = []
712722
mistyped_objects: list[SecurityContentObject_Abstract] = []
713723
missing_objects: list[str] = []

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.5.2"
4+
version = "5.5.3"
55

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

0 commit comments

Comments
 (0)