Browse Source

backward compatible master:pillar:reclass

Change-Id: I7636e3b43996abfa8be21f58ff485d998eacf74c
pull/63/head
Petr Michalec 7 years ago
parent
commit
8fbdd451c7
No account linked to committer's email address
2 changed files with 16 additions and 16 deletions
  1. +0
    -7
      metadata/service/master/pillar/saltclass.yml
  2. +16
    -9
      salt/files/master.conf

+ 0
- 7
metadata/service/master/pillar/saltclass.yml View File

parameters:
salt:
master:
pillar:
engine: saltclass
saltclass:
path: /srv/salt/saltclass

+ 16
- 9
salt/files/master.conf View File

- {{ master.pillar.get('salt', {}).get('path', '/srv/salt/pillar') }} - {{ master.pillar.get('salt', {}).get('path', '/srv/salt/pillar') }}
{%- endif %} {%- endif %}


{%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined) %}
{%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined) %}


reclass: &reclass reclass: &reclass
storage_type: {{ master.pillar.get('reclass', {'storage_type': 'yaml_fs'}).storage_type }} storage_type: {{ master.pillar.get('reclass', {'storage_type': 'yaml_fs'}).storage_type }}
inventory_base_uri: {{ master.pillar.get('reclass', {'inventory_base_uri': '/srv/salt/reclass'}).inventory_base_uri }} inventory_base_uri: {{ master.pillar.get('reclass', {'inventory_base_uri': '/srv/salt/reclass'}).inventory_base_uri }}
{# Additional options, for backward compatibility salt:master:pillar might not be defined #}
{%- if master.pillar.reclass is defined %}
{%- if master.pillar.reclass.reclass_source_path is defined %} {%- if master.pillar.reclass.reclass_source_path is defined %}
reclass_source_path: {{ master.pillar.reclass.reclass_source_path }} reclass_source_path: {{ master.pillar.reclass.reclass_source_path }}
{%- endif %} {%- endif %}
ignore_class_notfound: {{ master.pillar.reclass.ignore_class_notfound }} ignore_class_notfound: {{ master.pillar.reclass.ignore_class_notfound }}
ignore_class_regexp: {{ master.pillar.reclass.ignore_class_regexp }} ignore_class_regexp: {{ master.pillar.reclass.ignore_class_regexp }}
{%- endif %} {%- endif %}
{%- endif %}
{%- endif %} {%- endif %}


{%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
{%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}


saltclass: &saltclass saltclass: &saltclass
path: {{ master.pillar.saltclass.get('path', '/srv/salt/saltclass') }} path: {{ master.pillar.saltclass.get('path', '/srv/salt/saltclass') }}
{%- endif %} {%- endif %}




{%- if master.pillar.engine in ['composite', 'reclass', 'saltclass'] %}
{%- if master.pillar.engine in ['composite', 'reclass'] %}
{# generate indexed list of ext_engines #} {# generate indexed list of ext_engines #}
{# NONE: Might be rewritten, once proved to work properly, with filters: #} {# NONE: Might be rewritten, once proved to work properly, with filters: #}
{# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #} {# NONE: select('mapping')|selectattr('_index')|sort(attribute='_index') #}
{%- set index = engine.get('index', '1')~'-'~name %} {%- set index = engine.get('index', '1')~'-'~name %}
{%- do ext_engines.update({ index: engine }) %} {%- do ext_engines.update({ index: engine }) %}
{%- endfor %} {%- endfor %}
{%- if ext_engines|length > 0 %}
{%- if ext_engines|length > 0 or master.pillar.engine == "reclass" %}


ext_pillar: ext_pillar:
{%- if master.pillar.engine == 'reclass' %}
{#- too keep backward compatibility, in case master.pillar.reclass is not defied at all #}
- reclass: *reclass
{%- endif %}
{%- for name, engine in ext_engines|dictsort %} {%- for name, engine in ext_engines|dictsort %}
{%- if master.pillar.engine in ['composite', 'reclass'] and engine.name == 'reclass' %}
{%- if master.pillar.engine == 'composite' and engine.name == 'reclass' %}
- reclass: *reclass - reclass: *reclass
{%- endif %} {%- endif %}
{%- if master.pillar.engine in ['composite', 'saltclass'] and engine.name == 'saltclass' %}
{%- if engine.name == 'saltclass' %}
- saltclass: *saltclass - saltclass: *saltclass
{%- endif %} {%- endif %}
{%- if engine.name == 'nacl' %} {%- if engine.name == 'nacl' %}
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}


{%- if master.pillar.engine in ['saltclass', 'reclass']
{%- if master.pillar.engine == 'reclass'
or (master.pillar.engine == 'composite' and or (master.pillar.engine == 'composite' and
(master.pillar.saltclass is defined or (master.pillar.saltclass is defined or
master.pillar.reclass is defined )) %} master.pillar.reclass is defined )) %}


master_tops: master_tops:
{%- if master.pillar.engine in ['composite', 'reclass'] and master.pillar.get('reclass', False) %}
{%- if master.pillar.engine == 'reclass' or (master.pillar.engine == 'composite' and master.pillar.reclass is defined ) %}
reclass: *reclass reclass: *reclass
{%- endif %} {%- endif %}
{%- if master.pillar.engine in ['composite', 'saltclass'] and master.pillar.get('saltclass', False) %}
{%- if master.pillar.engine == 'saltclass' or (master.pillar.engine == 'composite' and master.pillar.saltclass is defined ) %}
saltclass: *saltclass saltclass: *saltclass
{%- endif %} {%- endif %}
{%- endif %} {%- endif %}

Loading…
Cancel
Save