mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
parent
623a11d067
commit
b837be080c
@ -635,7 +635,9 @@ class State(object):
|
|||||||
cmd = self.functions['cmd.retcode'](entry, ignore_retcode=True, **cmd_opts)
|
cmd = self.functions['cmd.retcode'](entry, ignore_retcode=True, **cmd_opts)
|
||||||
log.debug('Last command return code: {0}'.format(cmd))
|
log.debug('Last command return code: {0}'.format(cmd))
|
||||||
if cmd != 0 and ret['result'] is False:
|
if cmd != 0 and ret['result'] is False:
|
||||||
ret.update({'comment': 'onlyif execution failed', 'result': True})
|
ret.update({'comment': 'onlyif execution failed',
|
||||||
|
'skip_watch': True,
|
||||||
|
'result': True})
|
||||||
return ret
|
return ret
|
||||||
elif cmd == 0:
|
elif cmd == 0:
|
||||||
ret.update({'comment': 'onlyif execution succeeded', 'result': False})
|
ret.update({'comment': 'onlyif execution succeeded', 'result': False})
|
||||||
@ -650,7 +652,9 @@ class State(object):
|
|||||||
cmd = self.functions['cmd.retcode'](entry, ignore_retcode=True, **cmd_opts)
|
cmd = self.functions['cmd.retcode'](entry, ignore_retcode=True, **cmd_opts)
|
||||||
log.debug('Last command return code: {0}'.format(cmd))
|
log.debug('Last command return code: {0}'.format(cmd))
|
||||||
if cmd == 0 and ret['result'] is False:
|
if cmd == 0 and ret['result'] is False:
|
||||||
ret.update({'comment': 'unless execution succeeded', 'result': True})
|
ret.update({'comment': 'unless execution succeeded',
|
||||||
|
'skip_watch': True,
|
||||||
|
'result': True})
|
||||||
elif cmd != 0:
|
elif cmd != 0:
|
||||||
ret.update({'comment': 'unless execution failed', 'result': False})
|
ret.update({'comment': 'unless execution failed', 'result': False})
|
||||||
return ret
|
return ret
|
||||||
@ -1854,7 +1858,7 @@ class State(object):
|
|||||||
self.__run_num += 1
|
self.__run_num += 1
|
||||||
elif status == 'change' and not low.get('__prereq__'):
|
elif status == 'change' and not low.get('__prereq__'):
|
||||||
ret = self.call(low, chunks, running)
|
ret = self.call(low, chunks, running)
|
||||||
if not ret['changes']:
|
if not ret['changes'] and not ret.get('skip_watch', False):
|
||||||
low = low.copy()
|
low = low.copy()
|
||||||
low['sfun'] = low['fun']
|
low['sfun'] = low['fun']
|
||||||
low['fun'] = 'mod_watch'
|
low['fun'] = 'mod_watch'
|
||||||
|
@ -301,6 +301,7 @@ def mod_run_check(cmd_kwargs, onlyif, unless, group, creates):
|
|||||||
log.debug('Last command return code: {0}'.format(cmd))
|
log.debug('Last command return code: {0}'.format(cmd))
|
||||||
if cmd != 0:
|
if cmd != 0:
|
||||||
return {'comment': 'onlyif execution failed',
|
return {'comment': 'onlyif execution failed',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
elif isinstance(onlyif, list):
|
elif isinstance(onlyif, list):
|
||||||
for entry in onlyif:
|
for entry in onlyif:
|
||||||
@ -308,11 +309,13 @@ def mod_run_check(cmd_kwargs, onlyif, unless, group, creates):
|
|||||||
log.debug('Last command return code: {0}'.format(cmd))
|
log.debug('Last command return code: {0}'.format(cmd))
|
||||||
if cmd != 0:
|
if cmd != 0:
|
||||||
return {'comment': 'onlyif execution failed',
|
return {'comment': 'onlyif execution failed',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
elif not isinstance(onlyif, string_types):
|
elif not isinstance(onlyif, string_types):
|
||||||
if not onlyif:
|
if not onlyif:
|
||||||
log.debug('Command not run: onlyif did not evaluate to string_type')
|
log.debug('Command not run: onlyif did not evaluate to string_type')
|
||||||
return {'comment': 'onlyif execution failed',
|
return {'comment': 'onlyif execution failed',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
|
|
||||||
if unless is not None:
|
if unless is not None:
|
||||||
@ -321,6 +324,7 @@ def mod_run_check(cmd_kwargs, onlyif, unless, group, creates):
|
|||||||
log.debug('Last command return code: {0}'.format(cmd))
|
log.debug('Last command return code: {0}'.format(cmd))
|
||||||
if cmd == 0:
|
if cmd == 0:
|
||||||
return {'comment': 'unless execution succeeded',
|
return {'comment': 'unless execution succeeded',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
elif isinstance(unless, list):
|
elif isinstance(unless, list):
|
||||||
for entry in unless:
|
for entry in unless:
|
||||||
@ -328,11 +332,13 @@ def mod_run_check(cmd_kwargs, onlyif, unless, group, creates):
|
|||||||
log.debug('Last command return code: {0}'.format(cmd))
|
log.debug('Last command return code: {0}'.format(cmd))
|
||||||
if cmd == 0:
|
if cmd == 0:
|
||||||
return {'comment': 'unless execution succeeded',
|
return {'comment': 'unless execution succeeded',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
elif not isinstance(unless, string_types):
|
elif not isinstance(unless, string_types):
|
||||||
if unless:
|
if unless:
|
||||||
log.debug('Command not run: unless did not evaluate to string_type')
|
log.debug('Command not run: unless did not evaluate to string_type')
|
||||||
return {'comment': 'unless execution succeeded',
|
return {'comment': 'unless execution succeeded',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
|
|
||||||
if isinstance(creates, string_types) and os.path.exists(creates):
|
if isinstance(creates, string_types) and os.path.exists(creates):
|
||||||
|
@ -4021,6 +4021,7 @@ def mod_run_check_cmd(cmd, filename):
|
|||||||
_cmd = '{0} {1}'.format(cmd, filename)
|
_cmd = '{0} {1}'.format(cmd, filename)
|
||||||
if __salt__['cmd.retcode'](_cmd) != 0:
|
if __salt__['cmd.retcode'](_cmd) != 0:
|
||||||
return {'comment': 'check_cmd execution failed',
|
return {'comment': 'check_cmd execution failed',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
|
|
||||||
# No reason to stop, return True
|
# No reason to stop, return True
|
||||||
|
@ -582,11 +582,13 @@ def mod_run_check(cmd_kwargs, onlyif, unless):
|
|||||||
if onlyif:
|
if onlyif:
|
||||||
if __salt__['cmd.retcode'](onlyif, **cmd_kwargs) != 0:
|
if __salt__['cmd.retcode'](onlyif, **cmd_kwargs) != 0:
|
||||||
return {'comment': 'onlyif execution failed',
|
return {'comment': 'onlyif execution failed',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
|
|
||||||
if unless:
|
if unless:
|
||||||
if __salt__['cmd.retcode'](unless, **cmd_kwargs) == 0:
|
if __salt__['cmd.retcode'](unless, **cmd_kwargs) == 0:
|
||||||
return {'comment': 'unless execution succeeded',
|
return {'comment': 'unless execution succeeded',
|
||||||
|
'skip_watch': True,
|
||||||
'result': True}
|
'result': True}
|
||||||
|
|
||||||
# No reason to stop, return True
|
# No reason to stop, return True
|
||||||
|
Loading…
Reference in New Issue
Block a user