Переглянути джерело

backward compatible master:pillar:reclass

Change-Id: I7636e3b43996abfa8be21f58ff485d998eacf74c
pull/63/head
Petr Michalec 7 роки тому
джерело
коміт
8fbdd451c7
Аккаунт користувача з таким Email не знайдено
2 змінених файлів з 16 додано та 16 видалено
  1. +0
    -7
      metadata/service/master/pillar/saltclass.yml
  2. +16
    -9
      salt/files/master.conf

+ 0
- 7
metadata/service/master/pillar/saltclass.yml Переглянути файл

@@ -1,7 +0,0 @@
parameters:
salt:
master:
pillar:
engine: saltclass
saltclass:
path: /srv/salt/saltclass

+ 16
- 9
salt/files/master.conf Переглянути файл

@@ -58,11 +58,13 @@ pillar_roots:
- {{ master.pillar.get('salt', {}).get('path', '/srv/salt/pillar') }}
{%- 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
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 }}
{# 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 %}
reclass_source_path: {{ master.pillar.reclass.reclass_source_path }}
{%- endif %}
@@ -80,16 +82,17 @@ reclass: &reclass
ignore_class_notfound: {{ master.pillar.reclass.ignore_class_notfound }}
ignore_class_regexp: {{ master.pillar.reclass.ignore_class_regexp }}
{%- 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
path: {{ master.pillar.saltclass.get('path', '/srv/salt/saltclass') }}
{%- endif %}


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

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 %}
{%- if master.pillar.engine in ['composite', 'reclass'] and engine.name == 'reclass' %}
{%- if master.pillar.engine == 'composite' and engine.name == 'reclass' %}
- reclass: *reclass
{%- endif %}
{%- if master.pillar.engine in ['composite', 'saltclass'] and engine.name == 'saltclass' %}
{%- if engine.name == 'saltclass' %}
- saltclass: *saltclass
{%- endif %}
{%- if engine.name == 'nacl' %}
@@ -120,16 +127,16 @@ ext_pillar:
{%- endif %}
{%- endif %}

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

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
{%- 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
{%- endif %}
{%- endif %}

Завантаження…
Відмінити
Зберегти