Use iteritems() instead of items().

Signed-off-by: René Jochum <rene@jochums.at>
This commit is contained in:
René Jochum 2015-07-13 15:59:44 +02:00
parent a013b79027
commit 064d489f41

View File

@ -1,15 +1,18 @@
include: {%- macro print_name(identifier, key) -%}
- openssh {%- if 'name' in key %}
{%- from "openssh/map.jinja" import openssh with context -%} {{ key['name'] }}
{%- set openssh_pillar = pillar.get('openssh', {}) -%} {%- else %}
{%- set auth = openssh_pillar.get('auth', {}) -%} {{ identifier }}
{%- for user,keys in auth.iteritems() -%} {%- endif %}
{%- for key in keys -%} {%- endmacro -%}
{% if 'present' in key and key['present'] %}
{{ key['name'] }}: {%- macro print_ssh_auth(identifier, key) -%}
ssh_auth.present: {%- if 'user' in key %}
- user: {{ user }} - user: {{ key['user'] }}
{%- if 'source' in key %} {%- else %}
- user: {{ identifier }}
{%- endif %}
{%- if 'present' in key and key['present'] and 'source' in key %}
- source: {{ key['source'] }} - source: {{ key['source'] }}
{%- else %} {%- else %}
{%- if 'enc' in key %} {%- if 'enc' in key %}
@ -22,21 +25,25 @@ include:
- options: {{ key['options'] }} - options: {{ key['options'] }}
{%- endif -%} {%- endif -%}
{%- endif %} {%- endif %}
{%- endmacro -%}
include:
- openssh
{%- from "openssh/map.jinja" import openssh with context -%}
{%- set openssh_pillar = pillar.get('openssh', {}) -%}
{%- set auth = openssh_pillar.get('auth', {}) -%}
{%- for identifier,keys in auth.iteritems() -%}
{%- for key in keys -%}
{% if 'present' in key and key['present'] %}
{{ print_name(identifier, key) }}:
ssh_auth.present:
{{ print_ssh_auth(identifier, key) }}
- require: - require:
- service: {{ openssh.service }} - service: {{ openssh.service }}
{%- else %} {%- else %}
{{ key['name'] }}: {{ print_name(identifier, key) }}:
ssh_auth.absent: ssh_auth.absent:
- user: {{ user }} {{ print_ssh_auth(identifier, key) }}
{%- if 'enc' in key %}
- enc: {{ key['enc'] }}
{%- endif -%}
{%- if 'comment' in key %}
- comment: {{ key['comment'] }}
{%- endif -%}
{%- if 'options' in key %}
- options: {{ key['options'] }}
{%- endif -%}
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
{%- endfor -%} {%- endfor -%}