mirror of
https://github.com/thegeeklab/ansible-later.git
synced 2024-11-22 21:00:44 +00:00
add detection for duplicate ids in standards
This commit is contained in:
parent
10aaa8e7e3
commit
a3b6ef54a3
@ -6,6 +6,7 @@ import sys
|
|||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
import ansible
|
import ansible
|
||||||
|
import toolz
|
||||||
|
|
||||||
from ansiblelater import settings
|
from ansiblelater import settings
|
||||||
from ansiblelater import utils
|
from ansiblelater import utils
|
||||||
@ -48,4 +49,11 @@ def get_standards(filepath):
|
|||||||
"Please upgrade ansible-later." %
|
"Please upgrade ansible-later." %
|
||||||
(standards.ansible_review_min_version, utils.get_property("__version__")))
|
(standards.ansible_review_min_version, utils.get_property("__version__")))
|
||||||
|
|
||||||
|
normalized_std = (list(toolz.remove(lambda x: x.id == "", standards.standards)))
|
||||||
|
unique_std = len(list(toolz.unique(normalized_std, key=lambda x: x.id)))
|
||||||
|
all_std = len(normalized_std)
|
||||||
|
if not all_std == unique_std:
|
||||||
|
utils.sysexit_with_message(
|
||||||
|
"Detect duplicate ID's in standards definition. Please use unique ID's only.")
|
||||||
|
|
||||||
return standards.standards
|
return standards.standards
|
||||||
|
Loading…
Reference in New Issue
Block a user