Added puppet pillar and documentation

This commit is contained in:
Pete Emerson 2013-03-12 17:41:40 +00:00
parent ccf1231d67
commit 86318d3da6
4 changed files with 49 additions and 0 deletions

View file

@ -35975,6 +35975,12 @@ T} T{
This pillar module parses a config file (specified in the salt master config),
T}
_
T{
\fBpuppet\fP
T} T{
Execute a puppet_node_classifier command and read the output as YAML. The YAML data is then directly
T}
_
.TE
.SS salt.pillar.cmd_json
.sp
@ -36106,6 +36112,15 @@ The final result set is merged with the pillar data.
.B salt.pillar.pillar_ldap.ext_pillar(pillar, config_file)
Execute LDAP searches and return the aggregated data
.UNINDENT
.SS salt.pillar.puppet
.sp
Execute a puppet_node_classifier command and read the output as YAML.
The YAML data is then directly overlaid onto the minion\(aqs pillar data
.INDENT 0.0
.TP
.B salt.pillar.puppet.ext_pillar(pillar, command)
Execute a puppet_node_classifier command and read the output as YAML
.UNINDENT
.SH MASTER TOPS
.sp
Salt includes a number of built\-in subsystems to generate top file data, they

View file

@ -15,3 +15,4 @@ Full list of builtin pillar modules
hiera
mongo
pillar_ldap
puppet

View file

@ -0,0 +1,6 @@
====================
salt.pillar.puppet
====================
.. automodule:: salt.pillar.puppet
:members:

27
salt/pillar/puppet.py Normal file
View file

@ -0,0 +1,27 @@
'''
Execute an unmodified puppet_node_classifier and read the output as YAML.
The YAML data is then directly overlaid onto the minion's pillar data.
'''
# Import python libs
import logging
# Import third party libs
import yaml
# Set up logging
log = logging.getLogger(__name__)
def ext_pillar(pillar, command):
'''
Execute an unmodified puppet_node_classifier and read the output as YAML
'''
try:
data = yaml.safe_load(__salt__['cmd.run']('{0}'.format(command + ' ' + __grains__.get('nodename'))))
data = data['parameters']
return data
except Exception:
log.critical(
'YAML data from {0} failed to parse'.format(command)
)
return {}