diff --git a/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py b/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py index 3105f223..6eea44b6 100644 --- a/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py +++ b/contentctl/objects/abstract_security_content_objects/security_content_object_abstract.py @@ -12,6 +12,7 @@ import pprint import uuid from abc import abstractmethod +from collections import Counter from difflib import get_close_matches from functools import cached_property from typing import List, Optional, Tuple, Union @@ -708,6 +709,15 @@ def mapNamesToSecurityContentObjects( "an error in the contentctl codebase which must be resolved." ) + # Catch all for finding duplicates in mapped content + if ( + len(duplicates := [name for name, count in Counter(v).items() if count > 1]) + > 0 + ): + raise ValueError( + f"Duplicate {cls.__name__} ({duplicates}) found in list: {v}." + ) + mappedObjects: list[Self] = [] mistyped_objects: list[SecurityContentObject_Abstract] = [] missing_objects: list[str] = [] diff --git a/pyproject.toml b/pyproject.toml index 577dccff..1f6940fd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.poetry] name = "contentctl" -version = "5.5.2" +version = "5.5.3" description = "Splunk Content Control Tool" authors = ["STRT "]