New onchanges/onfail failure types for requisite resolver

Refs #16370
This commit is contained in:
Mike Place 2014-10-10 14:34:11 -06:00
parent ad4c662946
commit 3d650099d9

View File

@ -1675,7 +1675,7 @@ class State(object):
continue continue
if r_state == 'onfail': if r_state == 'onfail':
if run_dict[tag]['result'] is True: if run_dict[tag]['result'] is True:
fun_stats.add('fail') fun_stats.add('onfail')
continue continue
else: else:
if run_dict[tag]['result'] is False: if run_dict[tag]['result'] is False:
@ -1683,7 +1683,7 @@ class State(object):
continue continue
if r_state == 'onchanges': if r_state == 'onchanges':
if not run_dict[tag]['changes']: if not run_dict[tag]['changes']:
fun_stats.add('fail') fun_stats.add('onchanges')
continue continue
if r_state == 'watch' and run_dict[tag]['changes']: if r_state == 'watch' and run_dict[tag]['changes']:
fun_stats.add('change') fun_stats.add('change')
@ -1703,6 +1703,10 @@ class State(object):
if 'premet' in fun_stats: if 'premet' in fun_stats:
status = 'met' status = 'met'
status = 'pre' status = 'pre'
elif 'onfail' in fun_stats:
status = 'onfail'
elif 'onchanges' in fun_stats:
status = 'onchanges'
elif 'change' in fun_stats: elif 'change' in fun_stats:
status = 'change' status = 'change'
else: else:
@ -1870,6 +1874,20 @@ class State(object):
running[tag] = pre_ret running[tag] = pre_ret
self.pre[tag] = pre_ret self.pre[tag] = pre_ret
self.__run_num += 1 self.__run_num += 1
elif status == 'onfail':
running[tag] = {'changes': {},
'result': True,
'comment': 'State was not run because onfail req did not change',
'__run_num__': self.__run_num,
'__sls__': low['__sls__']}
self.__run_num +=1
elif status == 'onchanges':
running[tag] = {'changes': {},
'result': True,
'comment': 'State was not run because onchanges req did not change',
'__run_num__': self.__run_num,
'__sls__': low['__sls__']}
self.__run_num +=1
else: else:
if low.get('__prereq__'): if low.get('__prereq__'):
self.pre[tag] = self.call(low, chunks, running) self.pre[tag] = self.call(low, chunks, running)