Add configuration for key logfile path and ensure it uses root_dir

This commit is contained in:
Dan Colish 2012-03-01 09:48:30 -08:00
parent fe83dfc437
commit 2ef9c58e97
2 changed files with 8 additions and 7 deletions

View file

@ -529,8 +529,8 @@ class SaltKey(object):
action='store_true',
help='Supress output')
parser.add_option('--logfile',
dest='logfile',
parser.add_option('--key-logfile',
dest='key_logfile',
default='/var/log/salt/key.log',
help=('Send all output to a file. '
'Default is /var/log/salt/key.log'))
@ -566,7 +566,7 @@ class SaltKey(object):
opts = {}
opts['quiet'] = options.quiet
opts['logfile'] = options.logfile
opts['key_logfile'] = options.key_logfile
# I decided to always set this to info, since it really all is info or
# error.
opts['loglevel'] = 'info'
@ -596,7 +596,7 @@ class SaltKey(object):
Execute saltkey
'''
import salt.log
salt.log.setup_logfile_logger(self.opts['logfile'],
salt.log.setup_logfile_logger(self.opts['key_logfile'],
self.opts['loglevel'])
key = salt.cli.key.Key(self.opts)
key.run()

View file

@ -174,8 +174,7 @@ def minion_config(path):
opts['grains'] = salt.loader.grains(opts)
# Prepend root_dir to other paths
prepend_root_dir(opts, ['pki_dir', 'cachedir', 'log_file'])
prepend_root_dir(opts, ['pki_dir', 'cachedir', 'log_file', 'key_logfile'])
return opts
@ -214,6 +213,7 @@ def master_config(path):
'cluster_mode': 'paranoid',
'serial': 'msgpack',
'nodegroups': {},
'key_logfile': '/var/log/salt/key.log',
}
load_config(opts, path, 'SALT_MASTER_CONFIG')
@ -224,7 +224,8 @@ def master_config(path):
opts['aes'] = salt.crypt.Crypticle.generate_key_string()
# Prepend root_dir to other paths
prepend_root_dir(opts, ['pki_dir', 'cachedir', 'log_file', 'sock_dir'])
prepend_root_dir(opts, ['pki_dir', 'cachedir', 'log_file',
'sock_dir', 'key_logfile'])
# Enabling open mode requires that the value be set to True, and
# nothing else!