mirror of
https://github.com/saltstack-formulas/cron-formula.git
synced 2025-07-20 06:48:22 +02:00
style(jinja): use Jinja whitespace control
This commit is contained in:
parent
0eaf78c627
commit
2d1f7c2601
@ -1,41 +1,41 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{% from "cron/map.jinja" import cron_settings with context %}
|
{%- from "cron/map.jinja" import cron_settings with context %}
|
||||||
|
|
||||||
{% if 'tasks' in cron_settings %}
|
{%- if 'tasks' in cron_settings %}
|
||||||
{% for task,task_options in cron_settings.tasks.items() %}
|
{%- for task,task_options in cron_settings.tasks.items() %}
|
||||||
|
|
||||||
cron.{{ task }}:
|
cron.{{ task }}:
|
||||||
cron.{{ task_options.type|default('present') }}:
|
cron.{{ task_options.type|default('present') }}:
|
||||||
- name: '{{ task_options.name }}'
|
- name: '{{ task_options.name }}'
|
||||||
{% if 'user' in task_options %}
|
{%- if 'user' in task_options %}
|
||||||
- user: {{ task_options.user|default('root') }}
|
- user: {{ task_options.user|default('root') }}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'minute' in task_options %}
|
{%- if 'minute' in task_options %}
|
||||||
- minute: '{{ task_options.minute }}'
|
- minute: '{{ task_options.minute }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'hour' in task_options %}
|
{%- if 'hour' in task_options %}
|
||||||
- hour: '{{ task_options.hour }}'
|
- hour: '{{ task_options.hour }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'daymonth' in task_options %}
|
{%- if 'daymonth' in task_options %}
|
||||||
- daymonth: '{{ task_options.daymonth }}'
|
- daymonth: '{{ task_options.daymonth }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'month' in task_options %}
|
{%- if 'month' in task_options %}
|
||||||
- month: '{{ task_options.month }}'
|
- month: '{{ task_options.month }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'dayweek' in task_options %}
|
{%- if 'dayweek' in task_options %}
|
||||||
- dayweek: '{{ task_options.dayweek }}'
|
- dayweek: '{{ task_options.dayweek }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'commented' in task_options and task_options.commented %}
|
{%- if 'commented' in task_options and task_options.commented %}
|
||||||
- commented: True
|
- commented: True
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% if 'special' in task_options %}
|
{%- if 'special' in task_options %}
|
||||||
- special: '{{ task_options.special }}'
|
- special: '{{ task_options.special }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
- identifier: '{{ task }}'
|
- identifier: '{{ task }}'
|
||||||
{% if 'comment' in task_options %}
|
{%- if 'comment' in task_options %}
|
||||||
- comment: '{{ task_options.comment }}'
|
- comment: '{{ task_options.comment }}'
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
{% endfor %}
|
{%- endfor %}
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{% from "cron/map.jinja" import cron_settings with context %}
|
{%- from "cron/map.jinja" import cron_settings with context %}
|
||||||
|
|
||||||
cron.install:
|
cron.install:
|
||||||
pkg.installed:
|
pkg.installed:
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=jinja
|
# vim: ft=jinja
|
||||||
|
|
||||||
{% set os_family_map = salt['grains.filter_by']({
|
{%- set os_family_map = salt['grains.filter_by']({
|
||||||
'RedHat': {
|
'RedHat': {
|
||||||
'pkg': 'cronie',
|
'pkg': 'cronie',
|
||||||
'service': 'crond',
|
'service': 'crond',
|
||||||
@ -16,7 +16,7 @@
|
|||||||
},
|
},
|
||||||
}, grain='os_family', merge=salt['pillar.get']('cron:lookup')) %}
|
}, grain='os_family', merge=salt['pillar.get']('cron:lookup')) %}
|
||||||
|
|
||||||
{% set cron_settings = salt['pillar.get'](
|
{%- set cron_settings = salt['pillar.get'](
|
||||||
'cron',
|
'cron',
|
||||||
default=os_family_map,
|
default=os_family_map,
|
||||||
merge=True
|
merge=True
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: ft=sls
|
# vim: ft=sls
|
||||||
|
|
||||||
{% from "cron/map.jinja" import cron_settings with context %}
|
{%- from "cron/map.jinja" import cron_settings with context %}
|
||||||
|
|
||||||
cron.service:
|
cron.service:
|
||||||
{% if 'enabled' not in cron_settings or ( 'enabled' in cron_settings and cron_settings.enabled ) %}
|
{%- if 'enabled' not in cron_settings or ( 'enabled' in cron_settings and cron_settings.enabled ) %}
|
||||||
service.running:
|
service.running:
|
||||||
- name: {{ cron_settings.service }}
|
- name: {{ cron_settings.service }}
|
||||||
- enable: True
|
- enable: True
|
||||||
{% else %}
|
{%- else %}
|
||||||
service.dead:
|
service.dead:
|
||||||
- name: {{ cron_settings.service }}
|
- name: {{ cron_settings.service }}
|
||||||
- enable: False
|
- enable: False
|
||||||
{% endif %}
|
{%- endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user