mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Prepend current directory when path is just filename
This commit is contained in:
parent
c7bae5e795
commit
6d691b290b
1 changed files with 9 additions and 0 deletions
|
@ -595,10 +595,19 @@ class LogLevelMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
)
|
||||
)
|
||||
|
||||
def _logfile_callback(option, opt, value, parser, *args, **kwargs):
|
||||
if not os.path.dirname(value):
|
||||
# if the path is only a file name (no parent directory), assume current directory
|
||||
value = os.path.join(os.path.curdir, value)
|
||||
setattr(parser.values, self._logfile_config_setting_name_, value)
|
||||
|
||||
group.add_option(
|
||||
'--log-file',
|
||||
dest=self._logfile_config_setting_name_,
|
||||
default=None,
|
||||
action='callback',
|
||||
type='string',
|
||||
callback=_logfile_callback,
|
||||
help='Log file path. Default: \'{0}\'.'.format(
|
||||
self._default_logging_logfile_
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue