[wip] Change learn:modules to dictionary

This commit is contained in:
William Wernert
2021-07-29 11:58:58 -04:00
parent d53e989c55
commit 2560a9b78c
2 changed files with 6 additions and 6 deletions

View File

@@ -32,9 +32,9 @@ salt_proc: subprocess.CompletedProcess = None
# Temp store of modules, will likely be broken out into salt # Temp store of modules, will likely be broken out into salt
def get_learn_modules(): def get_learn_modules():
return [ return {
{ 'name': 'logscan', 'cpu_period': get_cpu_period(fraction=0.25), 'enabled': False, 'description': 'Scan log files against pre-trained models to alert on anomalies.' } 'logscan': { 'cpu_period': get_cpu_period(fraction=0.25), 'enabled': False, 'description': 'Scan log files against pre-trained models to alert on anomalies.' }
] }
def get_cpu_period(fraction: float): def get_cpu_period(fraction: float):

View File

@@ -1,12 +1,12 @@
{% from 'allowed_states.map.jinja' import allowed_states %} {% from 'allowed_states.map.jinja' import allowed_states %}
{% if sls in allowed_states %} {% if sls in allowed_states %}
{% set module_list = salt['pillar.get']('learn:modules', [] ) %} {% set module_dict = salt['pillar.get']('learn:modules', [] ) %}
{% if module_list|length != 0 %}} {% if module_list|length != 0 %}}
include: include:
{% for module in module_list %} {% for module, _ in module_dict %}
- .{{ module }} - 'learn.{{ module }}'
{% endfor %} {% endfor %}
{% endif %} {% endif %}