If a state is in prerequired, do not add to the self.pre to the list of requirements.

This commit is contained in:
Gareth J. Greenaway 2017-11-01 11:54:03 -06:00
parent d9dcb84fe3
commit 3ffab16a4d
No known key found for this signature in database
GPG Key ID: 10B62F8A7CAD7A41
2 changed files with 5 additions and 6 deletions

View File

@ -2236,7 +2236,7 @@ class State(object):
fun_stats = set() fun_stats = set()
for r_state, chunks in six.iteritems(reqs): for r_state, chunks in six.iteritems(reqs):
req_stats = set() req_stats = set()
if r_state == u'prereq': if r_state.startswith(u'prereq') and not r_state.startswith(u'prerequired'):
run_dict = self.pre run_dict = self.pre
else: else:
run_dict = running run_dict = running
@ -2267,9 +2267,11 @@ class State(object):
req_stats.add(u'change') req_stats.add(u'change')
continue continue
if r_state.startswith(u'prereq') and run_dict[tag][u'result'] is None: if r_state.startswith(u'prereq') and run_dict[tag][u'result'] is None:
req_stats.add(u'premet') if not r_state.startswith(u'prerequired'):
req_stats.add(u'premet')
if r_state.startswith(u'prereq') and not run_dict[tag][u'result'] is None: if r_state.startswith(u'prereq') and not run_dict[tag][u'result'] is None:
req_stats.add(u'pre') if not r_state.startswith(u'prerequired'):
req_stats.add(u'pre')
else: else:
req_stats.add(u'met') req_stats.add(u'met')
if r_state.endswith(u'_any'): if r_state.endswith(u'_any'):
@ -2459,7 +2461,6 @@ class State(object):
self.pre[tag][u'changes'] = {u'watch': u'watch'} self.pre[tag][u'changes'] = {u'watch': u'watch'}
self.pre[tag][u'result'] = None self.pre[tag][u'result'] = None
else: else:
log.error('==== low {} running {} chunks {} ===='.format(low, running, chunks))
running = self.call_chunk(low, running, chunks) running = self.call_chunk(low, running, chunks)
if self.check_failhard(chunk, running): if self.check_failhard(chunk, running):
running[u'__FAILHARD__'] = True running[u'__FAILHARD__'] = True

View File

@ -844,8 +844,6 @@ class StateModuleTest(ModuleCase, SaltReturnAssertsMixin):
result = self.normalize_ret(ret) result = self.normalize_ret(ret)
self.assertEqual(expected_result_simple, result) self.assertEqual(expected_result_simple, result)
log.error('=== ret {} ==='.format(ret))
return
# same test, but not using lists in yaml syntax # same test, but not using lists in yaml syntax
# TODO: issue #8235, prereq ignored when not used in list syntax # TODO: issue #8235, prereq ignored when not used in list syntax
# Currently fails badly with : # Currently fails badly with :