refactor(config): minimise and standardise between .sls & .tst

This commit is contained in:
Imran Iqbal committed 2019-10-23 19:02:16 +01:00
1 parent cce5e67c33
commit 18585bdc90
3 files changed
+38 -101

No files matched your search

+13 -15
View File
@@ -5,23 +5,21 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import cron with context %}
{%- if 'tasks' in cron %}
{%- for task, task_options in cron.tasks.items() %}
{%- for task, task_options in cron.get('tasks', {}).items() %}
{%- set cron_type = task_options.type|d('present') %}
cron.{{ task }}:
cron.{{ task_options.type|d('present') }}:
cron.{{ cron_type }}:
- name: {{ task_options.name }}
- identifier: '{{ task }}'
{%- if 'user' in task_options %}
- user: {{ task_options.user|d('root') }}
- identifier: '{{ task }}'
{%- if cron_type == 'present' %}
- commented: {{ task_options.commented|d(False) }}
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
{%- if section in task_options %}
- {{ section }}: '{{ task_options[section] }}'
{%- endif %}
{%- endfor %}
{%- endif %}
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
{%- if section in task_options %}
- {{ section }}: '{{ task_options.get(section) }}'
{%- endif %}
{%- endfor %}
{%- if task_options.commented|d(False) %}
- commented: True
{%- endif %}
{%- endfor %}
{%- endif %}
{%- endfor %}