Skip to content

Commit

Permalink
style(config.tst): rearrange Jinja statements for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Oct 15, 2019
1 parent aada0ae commit 8abec54
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cron/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{%- 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.tasks.items() %}
cron.{{ task }}:
cron.{{ task_options.type|default('present') }}:
Expand Down
40 changes: 20 additions & 20 deletions cron/saltcheck-tests/config.tst
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
{%- from "cron/saltcheck-tests/map.jinja" import cron with context %}

{%- if 'tasks' in cron %}
{%- for task,task_options in cron.tasks.items() %}
{%- for task, task_options in cron.tasks.items() %}

{%- if task_options.type == 'present' %}
{%- if task_options.type == 'present' %}
validate_cron.{{ task }}_exists:
module_and_function: cron.get_entry
args:
Expand All @@ -16,7 +16,7 @@ validate_cron.{{ task }}_exists:
assertion_section: identifier
expected-return: {{ task }}

{%- if 'minute' in task_options %}
{%- if 'minute' in task_options %}
validate_cron.{{ task }}_minute:
module_and_function: cron.get_entry
args:
Expand All @@ -25,9 +25,9 @@ validate_cron.{{ task }}_minute:
assertion: assertEqual
assertion_section: minute
expected-return: '{{ task_options.minute }}'
{%- endif %}
{%- endif %}

{%- if 'hour' in task_options %}
{%- if 'hour' in task_options %}
validate_cron.{{ task }}_hour:
module_and_function: cron.get_entry
args:
Expand All @@ -36,9 +36,9 @@ validate_cron.{{ task }}_hour:
assertion_section: hour
assertion: assertEqual
expected-return: '{{ task_options.hour }}'
{%- endif %}
{%- endif %}

{%- if 'daymonth' in task_options %}
{%- if 'daymonth' in task_options %}
validate_cron.{{ task }}_daymonth:
module_and_function: cron.get_entry
args:
Expand All @@ -47,9 +47,9 @@ validate_cron.{{ task }}_daymonth:
assertion_section: daymonth
assertion: assertEqual
expected-return: '{{ task_options.daymonth }}'
{%- endif %}
{%- endif %}

{%- if 'month' in task_options %}
{%- if 'month' in task_options %}
validate_cron.{{ task }}_month:
module_and_function: cron.get_entry
args:
Expand All @@ -58,9 +58,9 @@ validate_cron.{{ task }}_month:
assertion_section: month
assertion: assertEqual
expected-return: '{{ task_options.month }}'
{%- endif %}
{%- endif %}

{%- if 'dayweek' in task_options %}
{%- if 'dayweek' in task_options %}
validate_cron.{{ task }}_dayweek:
module_and_function: cron.get_entry
args:
Expand All @@ -69,9 +69,9 @@ validate_cron.{{ task }}_dayweek:
assertion_section: dayweek
assertion: assertEqual
expected-return: '{{ task_options.dayweek }}'
{%- endif %}
{%- endif %}

{%- if 'comment' in task_options %}
{%- if 'comment' in task_options %}
validate_cron.{{ task }}_comment:
module_and_function: cron.get_entry
args:
Expand All @@ -80,27 +80,27 @@ validate_cron.{{ task }}_comment:
assertion_section: comment
assertion: assertEqual
expected-return: {{ task_options.comment }}
{%- endif %}
{%- endif %}

{%- if 'commented' in task_options and task_options.commented %}
{%- if 'commented' in task_options and task_options.commented %}
validate_cron.{{ task }}_commented:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task }}
assertion_section: commented
assertion: assertTrue
{%- endif %}
{%- endif %}
{%- endif %}
{%- endif %}

{%- if task_options.type == 'absent' %}
{%- if task_options.type == 'absent' %}
validate_cron.{{ task }}_absent:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task }}
assertion: assertFalse
{%- endif %}
{%- endif %}

{%- endfor %}
{%- endfor %}
{%- endif %}

0 comments on commit 8abec54

Please sign in to comment.