set up configuration reading

This commit is contained in:
Thomas S Hatch 2011-02-26 16:07:24 -07:00
parent ed36409dcd
commit 61fb35147f

34
salt/config.py Normal file
View file

@ -0,0 +1,34 @@
# Import python modules
import os
import socket
# Import third party libs
import yaml
def minion_config(path):
'''
Reads in the minion configuration file and sets up special options
'''
opts = {'master': 'mcp',
'master_port': '7777',
'pki_dir': '/etc/salt/pki',
'hostname': socket.getfqdn(),
}
if os.path.isfile(path):
opts.update(yaml.load(open(conf, 'r')))
opts['master_uri'] = 'tcp://' + opts['master'] + ':' + opts['master_port']
return opts
def master_config(path):
'''
Reads in the master configuration file and sets up default options
'''
opts = {}
if os.path.isfile(path):
opts.update(yaml.load(open(conf, 'r')))
return opts