mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
set up configuration reading
This commit is contained in:
parent
ed36409dcd
commit
61fb35147f
1 changed files with 34 additions and 0 deletions
34
salt/config.py
Normal file
34
salt/config.py
Normal 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
|
Loading…
Add table
Reference in a new issue