Skip to content

Commit 329323b

Browse files
authored
Merge pull request #19 from babilen/empty-pillar-lookup
Check for presence of 'lookup' key
2 parents 2975f9b + 9d3f30e commit 329323b

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

sysctl/param.sls

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,32 +23,33 @@ sysctl-present-{{ param_name }}:
2323
{% endfor %}
2424
{% else %}
2525
{## Support for legacy pillar structure ##}
26-
{%- if sysctl_settings.lookup.params2 is defined -%}
27-
28-
{%- for param_name, param in sysctl_settings.lookup.get('params2', {}).items() -%}
29-
{%- if param is mapping %}
26+
{%- if sysctl_settings.lookup is defined %}
27+
{% if sysctl_settings.lookup.params2 is defined -%}
28+
{%- for param_name, param in sysctl_settings.lookup.get('params2', {}).items() -%}
29+
{%- if param is mapping %}
3030
sysctl-present-{{ param_name }}:
3131
sysctl.present:
3232
- name: {{ param_name }}
3333
- value: {{ param.value }}
34-
{%- if param.config is defined %}
34+
{%- if param.config is defined %}
3535
- config: {{ sysctl_settings.config.location }}/{{ param.config }}
36+
{% endif -%}
3637
{% endif -%}
37-
{% endif -%}
38-
{% endfor %}
38+
{% endfor %}
3939
40-
{% else %}
40+
{% else %}
4141
42-
{%- for param in sysctl_settings.lookup.get('params', {}) -%}
43-
{%- if param is mapping %}
42+
{%- for param in sysctl_settings.lookup.get('params', {}) -%}
43+
{%- if param is mapping %}
4444
sysctl-present-{{ param.name }}:
4545
sysctl.present:
4646
- name: {{ param.name }}
4747
- value: {{ param.value }}
4848
{%- if param.config is defined %}
4949
- config: {{ sysctl_settings.config.location }}/{{ param.config }}
50+
{% endif -%}
5051
{% endif -%}
51-
{% endif -%}
52-
{% endfor %}
52+
{% endfor %}
53+
{% endif -%}
5354
{%- endif -%}
5455
{%- endif -%}

0 commit comments

Comments
 (0)