diff --git a/salt/utils/parsers.py b/salt/utils/parsers.py index de996c9301..d45c8ddec2 100644 --- a/salt/utils/parsers.py +++ b/salt/utils/parsers.py @@ -38,6 +38,7 @@ import salt.utils.jid from salt.utils import kinds from salt.defaults import DEFAULT_TARGET_DELIM from salt.utils.validate.path import is_writeable +import salt.exceptions # Import 3rd-party libs import salt.ext.six as six @@ -385,7 +386,12 @@ class SaltfileMixIn(six.with_metaclass(MixInMeta, object)): 'Loading Saltfile from \'{0}\''.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