mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Complete fix saltstack/salt#1806
Turn the exit error into a warning. Added a logging message telling us what configuration file, if any, was loaded.
This commit is contained in:
parent
304b89fe38
commit
1bc1401448
@ -9,6 +9,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import logging
|
||||
import optparse
|
||||
from functools import partial
|
||||
from salt import config, log, version
|
||||
@ -119,6 +120,10 @@ class OptionParser(optparse.OptionParser):
|
||||
for mixin_after_parsed_func in self._mixin_after_parsed_funcs:
|
||||
mixin_after_parsed_func(self)
|
||||
|
||||
if self.config.get('conf_file', None) is not None:
|
||||
logging.getLogger(__name__).info(
|
||||
"Loaded configuration file: %s", self.config['conf_file']
|
||||
)
|
||||
# Retain the standard behaviour of optparse to return options and args
|
||||
return options, args
|
||||
|
||||
@ -210,7 +215,12 @@ class ConfigDirMixIn(DeprecatedConfigMessage):
|
||||
# XXX: Remove deprecation warning in next release
|
||||
self.print_config_warning()
|
||||
elif not os.path.isdir(self.options.config_dir):
|
||||
self.error("{0} is not a directory".format(self.options.config_dir))
|
||||
# No logging is configured yet
|
||||
sys.stderr.write(
|
||||
"WARNING: \"{0}\" directory does not exist.\n".format(
|
||||
self.options.config_dir
|
||||
)
|
||||
)
|
||||
|
||||
# Make sure we have an absolute path
|
||||
self.options.config_dir = os.path.abspath(self.options.config_dir)
|
||||
@ -691,7 +701,6 @@ class SaltCMDOptionParser(OptionParser, ConfigDirMixIn, TimeoutMixIn,
|
||||
self.config['fun'] = self.args[1]
|
||||
self.config['arg'] = self.args[2:]
|
||||
|
||||
|
||||
def setup_config(self):
|
||||
return config.master_config(self.get_config_file_path('master'))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user