Skip to content

Commit

Permalink
refactor(jinja): used shortened form of |default filter
Browse files Browse the repository at this point in the history
  • Loading branch information
myii committed Oct 17, 2019
1 parent 951a959 commit a0f891e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cron/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
{%- for task, task_options in cron.tasks.items() %}
cron.{{ task }}:
cron.{{ task_options.type|default('present') }}:
cron.{{ task_options.type|d('present') }}:
- name: {{ task_options.name }}
- identifier: '{{ task }}'
{%- if 'user' in task_options %}
- user: {{ task_options.user|default('root') }}
- user: {{ task_options.user|d('root') }}
{%- endif %}
{%- for section in ['minute', 'hour', 'daymonth', 'month', 'dayweek', 'comment', 'special'] %}
{%- if section in task_options %}
Expand Down
8 changes: 4 additions & 4 deletions cron/saltcheck-tests/config.tst
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
validate_cron.{{ task }}_absent:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task_options.user|d('root') }}
- {{ task }}
assertion: assertFalse

{%- elif task_options.type == 'present' %}
validate_cron.{{ task }}_exists:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task_options.user|d('root') }}
- {{ task }}
assertion: assertEqual
assertion_section: identifier
Expand All @@ -30,7 +30,7 @@ validate_cron.{{ task }}_exists:
validate_cron.{{ task }}_{{ section }}:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task_options.user|d('root') }}
- {{ task }}
assertion: assertEqual
assertion_section: {{ section }}
Expand All @@ -42,7 +42,7 @@ validate_cron.{{ task }}_{{ section }}:
validate_cron.{{ task }}_commented:
module_and_function: cron.get_entry
args:
- {{ task_options.user|default('root') }}
- {{ task_options.user|d('root') }}
- {{ task }}
assertion: assertTrue
assertion_section: commented
Expand Down

0 comments on commit a0f891e

Please sign in to comment.