mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
* Added "none" option for pillar_source_merging_strategy * added none to merging strategy in dictupdate so we no longer log warnings when it is selected * Updated documentation * fix for when pillar_source_merging_strategy is not set * Fix looking up pillar data when merging is set to "none" and no saltenv was passed * Fix looking up pillar data when merging is set to "none" and no saltenv was passed retry * Let's not break when no merging strategy is passed * Capitalisation * Update on doc
This commit is contained in:
parent
fe377b3da0
commit
5548ed771d
5 changed files with 24 additions and 6 deletions
|
@ -671,10 +671,10 @@
|
|||
#pillar_safe_render_error: True
|
||||
|
||||
# The pillar_source_merging_strategy option allows you to configure merging strategy
|
||||
# between different sources. It accepts four values: recurse, aggregate, overwrite,
|
||||
# or smart. Recurse will merge recursively mapping of data. Aggregate instructs
|
||||
# aggregation of elements between sources that use the #!yamlex renderer. Overwrite
|
||||
# will verwrite elements according the order in which they are processed. This is
|
||||
# between different sources. It accepts five values: none, recurse, aggregate, overwrite,
|
||||
# or smart. None will not do any merging at all. Recurse will merge recursively mapping of data.
|
||||
# Aggregate instructs aggregation of elements between sources that use the #!yamlex renderer. Overwrite
|
||||
# will overwrite elements according the order in which they are processed. This is
|
||||
# behavior of the 2014.1 branch and earlier. Smart guesses the best strategy based
|
||||
# on the "renderer" setting and is the default value.
|
||||
#pillar_source_merging_strategy: smart
|
||||
|
|
|
@ -7571,9 +7571,14 @@ New in version 2014.7.0.
|
|||
Default: \fBsmart\fP
|
||||
.sp
|
||||
The pillar_source_merging_strategy option allows you to configure merging
|
||||
strategy between different sources. It accepts 4 values:
|
||||
strategy between different sources. It accepts 5 values:
|
||||
.INDENT 0.0
|
||||
.IP \(bu 2
|
||||
\fBnone\fP:
|
||||
.sp
|
||||
It will not do any merging at all and only parse the pillar data from the passed
|
||||
environment and 'base' if no environment was specified.
|
||||
.IP \(bu 2
|
||||
\fBrecurse\fP:
|
||||
.sp
|
||||
it will merge recursively mapping of data. For example, theses 2 sources:
|
||||
|
|
|
@ -2636,7 +2636,10 @@ Pillar Merging Options
|
|||
Default: ``smart``
|
||||
|
||||
The pillar_source_merging_strategy option allows you to configure merging
|
||||
strategy between different sources. It accepts 4 values:
|
||||
strategy between different sources. It accepts 5 values:
|
||||
|
||||
* ``none``:
|
||||
It will not do any merging at all and only parse the pillar data from the passed environment and 'base' if no environment was specified.
|
||||
|
||||
* ``recurse``:
|
||||
|
||||
|
|
|
@ -279,6 +279,7 @@ class Pillar(object):
|
|||
self.actual_file_roots = opts['file_roots']
|
||||
# use the local file client
|
||||
self.opts = self.__gen_opts(opts, grains, saltenv=saltenv, ext=ext, pillarenv=pillarenv)
|
||||
self.saltenv = saltenv
|
||||
self.client = salt.fileclient.get_file_client(self.opts, True)
|
||||
|
||||
if opts.get('file_client', '') == 'local':
|
||||
|
@ -399,6 +400,11 @@ class Pillar(object):
|
|||
]
|
||||
else:
|
||||
for saltenv in self._get_envs():
|
||||
if self.opts.get('pillar_source_merging_strategy', None) == "none":
|
||||
if self.saltenv and saltenv != self.saltenv:
|
||||
continue
|
||||
if not self.saltenv and not saltenv == 'base':
|
||||
continue
|
||||
top = self.client.cache_file(
|
||||
self.opts['state_top'],
|
||||
saltenv
|
||||
|
|
|
@ -109,6 +109,10 @@ def merge(obj_a, obj_b, strategy='smart', renderer='yaml', merge_lists=False):
|
|||
merged = merge_aggregate(obj_a, obj_b)
|
||||
elif strategy == 'overwrite':
|
||||
merged = merge_overwrite(obj_a, obj_b, merge_lists)
|
||||
elif strategy == 'none':
|
||||
# If we do not want to merge, there is only one pillar passed, so we can safely use the default recurse,
|
||||
# we just do not want to log an error
|
||||
merged = merge_recurse(obj_a, obj_b)
|
||||
else:
|
||||
log.warning('Unknown merging strategy \'{0}\', '
|
||||
'fallback to recurse'.format(strategy))
|
||||
|
|
Loading…
Add table
Reference in a new issue