in src/queuealerter.py [0:0]
def validate_config(config: list):
"""
checks that the provided dictionary (parsed from yaml) is in fact a valid configuration.
Raises a ValueError if not.
:param config:
:return:
"""
if not isinstance(config, list):
raise ValueError("Configuration is invalid, the root element should be a list")
i = 0
for entry in config:
if not isinstance(entry, dict):
raise ValueError("Configuration is invalid, entry {0} is not an object".format(i))
if "queue" not in entry:
raise ValueError("Configuration is invalid, entry {0} does not specify 'queue'".format(i))
if not isinstance(entry["queue"], str):
raise ValueError("Configuration is invalid, entry {0} 'queue' is not a string")
if "threshold" not in entry:
raise ValueError("Configuration is invalid, entry {0} does not specify 'threshold'".format(i))
if not isinstance(entry["threshold"], int):
raise ValueError("Configuration is invalid, entry {0} 'thresold' is not an integer")
i += 1