Add pillar_roots_override_ext_pillar option and deprecate ext_pillar_first

This commit is contained in:
Kris Raney 2016-02-25 10:17:39 -06:00
parent f112888321
commit afa297e4d1
3 changed files with 41 additions and 8 deletions

View file

@ -54111,9 +54111,16 @@ salt\-cloud \-a suspend vmname
# \- hiera: /etc/hiera.yaml
# \- cmd_yaml: cat /etc/salt/yaml
# The pillar_roots_override_ext_pillar option allows for external pillar sources
# to be evaluated before the file system pillar, which means that values
# obtained from the file system pillar will take precedence over those found from
# external pillar sources.
#pillar_roots_override_ext_pillar: False
# The ext_pillar_first option allows for external pillar sources to populate
# before file system pillar. This allows for targeting file system pillar from
# ext_pillar.
# ext_pillar. Note that ext_pillar_first option is deprecated by
# pillar_roots_override_ext_pillar option and will be removed in future releases.
#ext_pillar_first: False
# The pillar_gitfs_ssl_verify option specifies whether to ignore ssl certificate

View file

@ -1942,6 +1942,24 @@ Default: ``None``
There are additional details at :ref:`salt-pillars`
.. conf_master:: pillar_roots_override_ext_pillar
``pillar_roots_override_ext_pillar``
--------------------
.. versionadded:: Boron
Default: ``False``
This option allows for external pillar sources to be evaluated before
:conf_master:`pillar_roots`, which means that values obtained from
:conf_master:`pillar_roots` take precedence over those found from
:conf_master:`ext_pillar` sources.
.. code-block:: yaml
pillar_roots_override_ext_pillar: False
.. conf_master:: ext_pillar_first
``ext_pillar_first``
@ -1953,7 +1971,8 @@ Default: ``False``
This option allows for external pillar sources to be evaluated before
:conf_master:`pillar_roots`. This allows for targeting file system pillar from
ext_pillar.
ext_pillar. Note that ext_pillar_first option is deprecated by
pillar_roots_override_ext_pillar option and will be removed in future releases.
.. code-block:: yaml

View file

@ -773,15 +773,22 @@ class Pillar(object):
'''
top, top_errors = self.get_top()
if ext:
if self.opts.get('ext_pillar_first', False):
if self.opts.get('pillar_roots_override_ext_pillar', False) or self.opts.get('ext_pillar_first', False):
self.opts['pillar'] = self.ext_pillar({}, pillar_dirs)
matches = self.top_matches(top)
pillar, errors = self.render_pillar(matches)
pillar = merge(self.opts['pillar'],
pillar,
self.merge_strategy,
self.opts.get('renderer', 'yaml'),
self.opts.get('pillar_merge_lists', False))
if self.opts.get('pillar_roots_override_ext_pillar', False):
pillar = merge(self.opts['pillar'],
pillar,
self.merge_strategy,
self.opts.get('renderer', 'yaml'),
self.opts.get('pillar_merge_lists', False))
else:
pillar = merge(pillar,
self.opts['pillar'],
self.merge_strategy,
self.opts.get('renderer', 'yaml'),
self.opts.get('pillar_merge_lists', False))
else:
matches = self.top_matches(top)
pillar, errors = self.render_pillar(matches)