Fix readding and updating logfile and pidfile config options for Salt API

This commit is contained in:
Denys Havrysh 2016-11-16 10:49:49 +02:00
parent f47253c21b
commit 45dffa292f

View file

@ -3285,24 +3285,16 @@ def client_config(path, env_var='SALT_CLIENT_CONFIG', defaults=None):
def api_config(path):
'''
Read in the salt master config file and add additional configs that
Read in the Salt Master config file and add additional configs that
need to be stubbed out for salt-api
'''
# Let's grab a copy of salt's master opts
opts = client_config(path, defaults=DEFAULT_MASTER_OPTS)
# Let's override them with salt-api's required defaults
api_opts = {
'log_file': opts.get(
'api_logfile', os.path.join(
opts['root_dir'], DEFAULT_API_OPTS['api_logfile'].lstrip('/')
)
),
'pidfile': opts.get(
'api_pidfile', os.path.join(
opts['root_dir'], DEFAULT_API_OPTS['api_pidfile'].lstrip('/')
)
),
}
api_opts = DEFAULT_API_OPTS
api_opts.update({
'pidfile': opts.get('api_pidfile', DEFAULT_API_OPTS['api_pidfile']),
})
opts.update(api_opts)
return opts