0
0
mirror of https://github.com/saltstack-formulas/sysctl-formula.git synced 2024-12-18 08:53:06 +01:00
sysctl-formula/sysctl/param.sls
Imran Iqbal 50494dc46f
fix(param.sls): fix salt-lint errors
```bash
Examining sysctl/param.sls of type state
[209] Jinja comment should have spaces before and after: {# comment #}
sysctl/param.sls:4
{## import settings from map.jinja ##}

[209] Jinja comment should have spaces before and after: {# comment #}
sysctl/param.sls:25
{## Support for legacy pillar structure ##}
```
2019-10-09 18:40:17 +01:00

56 lines
1.7 KiB
Plaintext

# -*- coding: utf-8 -*-
# vim: ft=sls
{#- import settings from map.jinja #}
{%- from "sysctl/map.jinja" import sysctl_settings with context %}
{% if sysctl_settings.params is defined %}
{% for param_name, param in sysctl_settings.get('params').items() %}
{% if param is mapping %}
sysctl-present-{{ param_name }}:
sysctl.present:
- name: {{ param_name }}
- value: {{ param.value }}
{%- if param.config is defined %}
- config: {{ sysctl_settings.config.location }}/{{ param.config }}
{% endif -%}
{% else %}
sysctl-present-{{ param_name }}:
sysctl.present:
- name: {{ param_name }}
- value: {{ param }}
{% endif %}
{% endfor %}
{% else %}
{#- Support for legacy pillar structure #}
{%- if sysctl_settings.lookup is defined %}
{% if sysctl_settings.lookup.params2 is defined -%}
{%- for param_name, param in sysctl_settings.lookup.get('params2', {}).items() -%}
{%- if param is mapping %}
sysctl-present-{{ param_name }}:
sysctl.present:
- name: {{ param_name }}
- value: {{ param.value }}
{%- if param.config is defined %}
- config: {{ sysctl_settings.config.location }}/{{ param.config }}
{% endif -%}
{% endif -%}
{% endfor %}
{% else %}
{%- for param in sysctl_settings.lookup.get('params', {}) -%}
{%- if param is mapping %}
sysctl-present-{{ param.name }}:
sysctl.present:
- name: {{ param.name }}
- value: {{ param.value }}
{%- if param.config is defined %}
- config: {{ sysctl_settings.config.location }}/{{ param.config }}
{% endif -%}
{% endif -%}
{% endfor %}
{% endif -%}
{%- endif -%}
{%- endif -%}