mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Cover exception handling in the utils.parsers
This commit is contained in:
parent
5e8c0c6bdb
commit
30ed728d05
1 changed files with 7 additions and 1 deletions
|
@ -35,6 +35,7 @@ import salt.utils.xdg
|
|||
from salt.utils import kinds
|
||||
from salt.defaults import DEFAULT_TARGET_DELIM
|
||||
from salt.utils.validate.path import is_writeable
|
||||
import salt.exceptions
|
||||
|
||||
|
||||
def _sorted(mixins_or_funcs):
|
||||
|
@ -337,7 +338,12 @@ class SaltfileMixIn(six.with_metaclass(MixInMeta, object)):
|
|||
'Loading Saltfile from {0!r}'.format(self.options.saltfile)
|
||||
)
|
||||
|
||||
saltfile_config = config._read_conf_file(saltfile)
|
||||
try:
|
||||
saltfile_config = config._read_conf_file(saltfile)
|
||||
except salt.exceptions.SaltConfigurationError as error:
|
||||
self.error(error.message)
|
||||
self.exit(salt.defaults.exitcodes.EX_GENERIC,
|
||||
'{0}: error: {1}\n'.format(self.get_prog_name(), error.message))
|
||||
|
||||
if not saltfile_config:
|
||||
# No configuration was loaded from the Saltfile
|
||||
|
|
Loading…
Add table
Reference in a new issue