mirror of
https://github.com/valitydev/salt.git
synced 2024-11-09 01:36:48 +00:00
Merge pull request #2363 from kvbik/pillar-root-in-ext-pillar
update pillars directly and omit default args
This commit is contained in:
commit
a5261ebf8c
@ -304,7 +304,7 @@ class Pillar(object):
|
||||
errors += err
|
||||
return pillar, errors
|
||||
|
||||
def ext_pillar(self, pillar={}):
|
||||
def ext_pillar(self, pillar):
|
||||
'''
|
||||
Render the external pillar data
|
||||
'''
|
||||
@ -313,7 +313,6 @@ class Pillar(object):
|
||||
if not isinstance(self.opts['ext_pillar'], list):
|
||||
log.critical('The "ext_pillar" option is malformed')
|
||||
return {}
|
||||
ext = {}
|
||||
for run in self.opts['ext_pillar']:
|
||||
if not isinstance(run, dict):
|
||||
log.critical('The "ext_pillar" option is malformed')
|
||||
@ -326,14 +325,14 @@ class Pillar(object):
|
||||
continue
|
||||
try:
|
||||
if isinstance(val, dict):
|
||||
ext.update(self.ext_pillars[key](pillar=pillar, **val))
|
||||
pillar.update(self.ext_pillars[key](pillar, **val))
|
||||
elif isinstance(val, list):
|
||||
ext.update(self.ext_pillars[key](*val, pillar=pillar))
|
||||
pillar.update(self.ext_pillars[key](pillar, *val))
|
||||
else:
|
||||
ext.update(self.ext_pillars[key](val, pillar=pillar))
|
||||
pillar.update(self.ext_pillars[key](pillar, val))
|
||||
except Exception:
|
||||
log.exception('Failed to load ext_pillar {0}'.format(key))
|
||||
return ext
|
||||
return pillar
|
||||
|
||||
def compile_pillar(self):
|
||||
'''
|
||||
@ -342,7 +341,7 @@ class Pillar(object):
|
||||
top, terrors = self.get_top()
|
||||
matches = self.top_matches(top)
|
||||
pillar, errors = self.render_pillar(matches)
|
||||
pillar.update(self.ext_pillar(pillar=pillar))
|
||||
self.ext_pillar(pillar)
|
||||
errors.extend(terrors)
|
||||
if self.opts.get('pillar_opts', False):
|
||||
pillar['master'] = self.opts
|
||||
|
@ -13,7 +13,7 @@ import json
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def ext_pillar(command, pillar={}):
|
||||
def ext_pillar(pillar, command):
|
||||
'''
|
||||
Execute a command and read the output as JSON
|
||||
'''
|
||||
|
@ -13,7 +13,7 @@ import yaml
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def ext_pillar(command, pillar={}):
|
||||
def ext_pillar(pillar, command):
|
||||
'''
|
||||
Execute a command and read the output as YAML
|
||||
'''
|
||||
|
@ -24,7 +24,7 @@ def __virtual__():
|
||||
return 'hiera' if salt.utils.which('hiera') else False
|
||||
|
||||
|
||||
def ext_pillar(conf, pillar={}):
|
||||
def ext_pillar(pillar, conf):
|
||||
'''
|
||||
Execute hiera and return the data
|
||||
'''
|
||||
|
@ -79,8 +79,8 @@ def __virtual__():
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def ext_pillar(collection='pillar', id_field='_id', re_pattern=None,
|
||||
re_replace='', fields=None, pillar={}):
|
||||
def ext_pillar(pillar, collection='pillar', id_field='_id', re_pattern=None,
|
||||
re_replace='', fields=None):
|
||||
"""
|
||||
Connect to a mongo database and read per-node pillar information.
|
||||
|
||||
|
@ -141,7 +141,7 @@ def _do_search(conf):
|
||||
return result
|
||||
|
||||
|
||||
def ext_pillar(config_file, pillar={}):
|
||||
def ext_pillar(pillar, config_file):
|
||||
'''
|
||||
Execute LDAP searches and return the aggregated data
|
||||
'''
|
||||
|
Loading…
Reference in New Issue
Block a user