0
0
mirror of https://github.com/saltstack-formulas/cron-formula.git synced 2025-02-26 13:28:16 +01:00

54 lines
1.4 KiB
Scilab
Raw Normal View History

# -*- coding: utf-8 -*-
# vim: ft=sls
{%- from "cron/saltcheck-tests/map.jinja" import cron with context %}
2019-10-14 15:39:38 +01:00
{%- if 'tasks' in cron %}
{%- for task, task_options in cron.tasks.items() %}
2019-10-14 15:39:38 +01:00
{%- if task_options.type == 'present' %}
2019-10-14 15:39:38 +01:00
validate_cron.{{ task }}_exists:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task }}
assertion: assertEqual
assertion_section: identifier
expected-return: {{ task }}
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
{%- if section in task_options %}
validate_cron.{{ task }}_{{ section }}:
2019-10-14 15:39:38 +01:00
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task }}
assertion: assertEqual
assertion_section: {{ section }}
expected-return: '{{ task_options.get(section) }}'
{%- endif %}
{%- endfor %}
2019-10-14 15:39:38 +01:00
{%- if 'commented' in task_options and task_options.commented %}
2019-10-14 15:39:38 +01:00
validate_cron.{{ task }}_commented:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task }}
assertion: assertTrue
assertion_section: commented
{%- endif %}
{%- endif %}
2019-10-14 15:39:38 +01:00
{%- if task_options.type == 'absent' %}
2019-10-14 15:39:38 +01:00
validate_cron.{{ task }}_absent:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task }}
assertion: assertFalse
{%- endif %}
2019-10-14 15:39:38 +01:00
{%- endfor %}
2019-10-14 14:49:43 +01:00
{%- endif %}