in curator/helpers/testers.py [0:0]
def validate_filters(action, myfilters):
"""
Validate that myfilters are appropriate for the action type, e.g. no
index filters applied to a snapshot list.
:param action: An action name
:param myfilters: A list of filters to test.
:type action: str
:type myfilters: list
:returns: Validated list of filters
:rtype: list
"""
# Define which set of filtertypes to use for testing
if action in snapshot_actions():
filtertypes = snapshot_filtertypes()
else:
filtertypes = index_filtertypes()
for fil in myfilters:
if fil['filtertype'] not in filtertypes:
raise ConfigurationError(
f"\"{fil['filtertype']}\" filtertype is not compatible with "
f"action \"{action}\""
)
# If we get to this point, we're still valid. Return the original list
return myfilters