mirror of
https://github.com/saltstack-formulas/cron-formula.git
synced 2026-07-23 06:00:04 +02:00
refactor(jinja): used shortened form of |default filter
This commit is contained in:
@@ -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 %}
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
validate_cron.{{ task }}_absent:
|
||||
module_and_function: cron.get_entry
|
||||
args:
|
||||
- {{ task_options.user|default('root') }}
|
||||
- {{ task_options.user|d('root') }}
|
||||
- {{ task }}
|
||||
assertion: assertFalse
|
||||
|
||||
@@ -18,7 +18,7 @@ validate_cron.{{ task }}_absent:
|
||||
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
|
||||
@@ -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 }}
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user