mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 17:09:03 +00:00
DO! NOT! SQUASH! TRACEBACKS!
This commit is contained in:
parent
59809a1e1b
commit
72205a5a38
@ -1736,14 +1736,15 @@ class State(object):
|
||||
try:
|
||||
ret = self.states[cdata['full']](*cdata['args'],
|
||||
**cdata['kwargs'])
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
log.debug('An exception occurred in this state: %s', exc,
|
||||
exc_info_on_loglevel=logging.DEBUG)
|
||||
trb = traceback.format_exc()
|
||||
ret = {
|
||||
'result': False,
|
||||
'name': name,
|
||||
'changes': {},
|
||||
'comment': 'An exception occurred in this state: {0}'.format(
|
||||
trb)
|
||||
'comment': 'An exception occurred in this state: {0}'.format(trb)
|
||||
}
|
||||
|
||||
utc_finish_time = datetime.datetime.utcnow()
|
||||
@ -1919,7 +1920,9 @@ class State(object):
|
||||
self.states.inject_globals = {}
|
||||
if 'check_cmd' in low and '{0[state]}.mod_run_check_cmd'.format(low) not in self.states:
|
||||
ret.update(self._run_check_cmd(low))
|
||||
except Exception:
|
||||
except Exception as exc:
|
||||
log.debug('An exception occurred in this state: %s', exc,
|
||||
exc_info_on_loglevel=logging.DEBUG)
|
||||
trb = traceback.format_exc()
|
||||
# There are a number of possibilities to not have the cdata
|
||||
# populated with what we might have expected, so just be smart
|
||||
@ -1934,8 +1937,7 @@ class State(object):
|
||||
'result': False,
|
||||
'name': name,
|
||||
'changes': {},
|
||||
'comment': 'An exception occurred in this state: {0}'.format(
|
||||
trb)
|
||||
'comment': 'An exception occurred in this state: {0}'.format(trb)
|
||||
}
|
||||
finally:
|
||||
if low.get('__prereq__'):
|
||||
|
@ -5,9 +5,15 @@ Decorators for salt.state
|
||||
:codeauthor: :email:`Bo Maryniuk (bo@suse.de)`
|
||||
'''
|
||||
|
||||
# Import Python libs
|
||||
from __future__ import absolute_import, unicode_literals
|
||||
import logging
|
||||
|
||||
# Import salt libs
|
||||
from salt.exceptions import SaltException
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class OutputUnifier(object):
|
||||
def __init__(self, *policies):
|
||||
@ -24,12 +30,14 @@ class OutputUnifier(object):
|
||||
for pls in self.policies:
|
||||
try:
|
||||
result = pls(result)
|
||||
except Exception as ex:
|
||||
except Exception as exc:
|
||||
log.debug('An exception occurred in this state: %s', exc,
|
||||
exc_info_on_loglevel=logging.DEBUG)
|
||||
result = {
|
||||
'result': False,
|
||||
'name': 'later',
|
||||
'changes': {},
|
||||
'comment': 'An exception occurred in this state: {0}'.format(ex)
|
||||
'comment': 'An exception occurred in this state: {0}'.format(exc)
|
||||
}
|
||||
return result
|
||||
return _func
|
||||
|
Loading…
Reference in New Issue
Block a user