mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Use Salt default exit codes instead of hard-coded values
This commit is contained in:
parent
a84556e596
commit
67faa56bf1
1 changed files with 9 additions and 4 deletions
|
@ -39,6 +39,7 @@ import salt.utils.xdg
|
|||
import salt.exceptions
|
||||
import salt.utils.sdb
|
||||
from salt.utils.locales import sdecode
|
||||
import salt.defaults.exitcodes
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
@ -1561,9 +1562,13 @@ def load_config(path, env_var, default_path=None):
|
|||
out.write(ifile.read())
|
||||
|
||||
if salt.utils.validate.path.is_readable(path):
|
||||
opts = _read_conf_file(path)
|
||||
opts['conf_file'] = path
|
||||
return opts
|
||||
try:
|
||||
opts = _read_conf_file(path)
|
||||
opts['conf_file'] = path
|
||||
return opts
|
||||
except salt.exceptions.SaltConfigurationError as error:
|
||||
log.error(error.message)
|
||||
sys.exit(salt.defaults.exitcodes.EX_GENERIC)
|
||||
|
||||
log.debug('Missing configuration file: {0}'.format(path))
|
||||
return {}
|
||||
|
@ -1608,7 +1613,7 @@ def include_config(include, orig_path, verbose):
|
|||
try:
|
||||
opts = _read_conf_file(fn_)
|
||||
except salt.exceptions.SaltConfigurationError as error:
|
||||
sys.exit(1)
|
||||
sys.exit(salt.defaults.exitcodes.EX_GENERIC)
|
||||
include = opts.get('include', [])
|
||||
if include:
|
||||
opts.update(include_config(include, fn_, verbose))
|
||||
|
|
Loading…
Add table
Reference in a new issue