Hack to make rendering work on CentOS 6
!! Not tested with an actual !! !! configured `ext_pillar` yet !! - jinja on RHEL/CentOS 6 has no 'mapping' test (see salt-formula issue #193) - {% do ... %} allows no assignment, only function calls - of course, `type(foo) is dict` doesn't work because it's no jinja test - maybe `.isinstance()` would be nicer/more reliable
This commit is contained in:
parent
d34f63fdf0
commit
5327e921fe
@ -960,18 +960,23 @@ pillar_roots:
|
|||||||
|
|
||||||
{% if 'ext_pillar' in cfg_master %}
|
{% if 'ext_pillar' in cfg_master %}
|
||||||
{%- do default_keys.append('ext_pillar') %}
|
{%- do default_keys.append('ext_pillar') %}
|
||||||
|
{#- workaround for missing mapping test in CentOS 6, part A #}
|
||||||
|
{%- set is_mapping = {} %}
|
||||||
ext_pillar:
|
ext_pillar:
|
||||||
{%- for pillar in cfg_master['ext_pillar'] -%}
|
{%- for pillar in cfg_master['ext_pillar'] -%}
|
||||||
{%- for key in pillar -%}
|
{%- for key in pillar -%}
|
||||||
{%- if pillar[key] is string %}
|
{%- if pillar[key] is string %}
|
||||||
- {{ key }}: {{ pillar[key] }}
|
- {{ key }}: {{ pillar[key] }}
|
||||||
{%- elif pillar[key] is iterable and pillar[key] is not mapping %}
|
{#- workaround for missing mapping test in CentOS 6, part B #}
|
||||||
|
{%- do is_mapping.update({key: type(pillar[key]) == type({})}) %}
|
||||||
|
{%- elif pillar[key] is iterable and not is_mapping[key] %}
|
||||||
- {{ key }}:
|
- {{ key }}:
|
||||||
{%- for parameter in pillar[key] %}
|
{%- for parameter in pillar[key] %}
|
||||||
- {{ parameter }}
|
- {{ parameter }}
|
||||||
{%- endfor -%}
|
{%- endfor -%}
|
||||||
{%- elif pillar[key] is mapping and pillar[key] is not string %}
|
{#- workaround for missing mapping test in CentOS 6, part C #}
|
||||||
- {{ key }}:
|
{%- elif is_mapping[key] and pillar[key] is not string %}
|
||||||
|
- {{ key }}:
|
||||||
{%- for parameter in pillar[key] %}
|
{%- for parameter in pillar[key] %}
|
||||||
{{ parameter }}: {{pillar[key][parameter]}}
|
{{ parameter }}: {{pillar[key][parameter]}}
|
||||||
{%- endfor %}
|
{%- endfor %}
|
||||||
|
Loading…
Reference in New Issue
Block a user