Skip to content

Commit

Permalink
style(saltcheck): merge absent & present into one if block
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Oct 15, 2019
1 parent 6f2b323 commit 33f344c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions cron/saltcheck-tests/config.tst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,15 @@
{%- if 'tasks' in cron %}
{%- for task, task_options in cron.tasks.items() %}

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

{%- elif task_options.type == 'present' %}
validate_cron.{{ task }}_exists:
module_and_function: cron.get_entry
args:
Expand Down Expand Up @@ -40,14 +48,5 @@ validate_cron.{{ task }}_commented:
{%- endif %}
{%- endif %}

{%- 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 %}

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

0 comments on commit 33f344c

Please sign in to comment.