From 187da2c3aadd1d0e6a6853f04c54db454cab67c9 Mon Sep 17 00:00:00 2001 From: Dmitry Kuzmenko Date: Tue, 16 Feb 2016 15:58:28 +0300 Subject: [PATCH] Trigger onfail state if any target failed Previously onfail used AND logic, so it triggered the onfail state only if all targets failed. This fix changes the logic to trigger onfail state if ANY of targets is failed. --- salt/state.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/salt/state.py b/salt/state.py index 682f1e1cdd..484d73779d 100644 --- a/salt/state.py +++ b/salt/state.py @@ -1853,7 +1853,7 @@ class State(object): continue if r_state == 'onfail': if run_dict[tag]['result'] is True: - fun_stats.add('onfail') + fun_stats.add('onfail') # At least one state is OK continue else: if run_dict[tag]['result'] is False: @@ -1884,8 +1884,8 @@ class State(object): status = 'met' else: status = 'pre' - elif 'onfail' in fun_stats: - status = 'onfail' + elif 'onfail' in fun_stats and 'met' not in fun_stats: + status = 'onfail' # all onfail states are OK elif 'onchanges' in fun_stats and 'onchangesmet' not in fun_stats: status = 'onchanges' elif 'change' in fun_stats: