Update to run with Podman
This commit is contained in:
@@ -374,44 +374,6 @@ class ElasticsearchBackend(StorageBackend):
|
||||
|
||||
return search_query
|
||||
|
||||
def schedule_check_aggregations(self, rule_object, result_map):
|
||||
"""
|
||||
Check the results of a scheduled query for aggregations.
|
||||
"""
|
||||
if rule_object.aggs is None:
|
||||
return result_map
|
||||
for index, (meta, result) in result_map.items():
|
||||
# Default to true, if no aggs are found, we still want to match
|
||||
match = True
|
||||
for agg_name, (operator, number) in rule_object.aggs.items():
|
||||
if agg_name in meta["aggs"]:
|
||||
agg_value = meta["aggs"][agg_name]["value"]
|
||||
|
||||
# TODO: simplify this, match is default to True
|
||||
if operator == ">":
|
||||
if agg_value > number:
|
||||
match = True
|
||||
else:
|
||||
match = False
|
||||
elif operator == "<":
|
||||
if agg_value < number:
|
||||
match = True
|
||||
else:
|
||||
match = False
|
||||
elif operator == "=":
|
||||
if agg_value == number:
|
||||
match = True
|
||||
else:
|
||||
match = False
|
||||
else:
|
||||
match = False
|
||||
else:
|
||||
# No aggregation found, but it is required
|
||||
match = False
|
||||
result_map[index][0]["aggs"][agg_name]["match"] = match
|
||||
|
||||
return result_map
|
||||
|
||||
def schedule_query_results_test_sync(self, rule_object):
|
||||
"""
|
||||
Helper to run a scheduled query test with reduced functionality.
|
||||
|
||||
Reference in New Issue
Block a user