From 049a48f3d3cf4da60295bdff54faefa0ea27b33f Mon Sep 17 00:00:00 2001 From: Abhijit Menon-Sen Date: Fri, 11 Sep 2015 21:59:08 +0530 Subject: [PATCH] Test state.tasks_child_state before dereferencing I hit a traceback in the FAILED_TASKS case, but it seemed prudent to add guards in the other similar branches. --- lib/ansible/executor/play_iterator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index cebfd967013..ded62de2cc8 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -237,7 +237,7 @@ class PlayIterator: if task is None: # check to see if the child state was failed, if so we need to # fail here too so we don't continue iterating tasks - if state.tasks_child_state.fail_state != self.FAILED_NONE: + if state.tasks_child_state and state.tasks_child_state.fail_state != self.FAILED_NONE: state.fail_state |= self.FAILED_TASKS state.tasks_child_state = None state.cur_regular_task += 1 @@ -263,7 +263,7 @@ class PlayIterator: if task is None: # check to see if the child state was failed, if so we need to # fail here too so we don't continue iterating rescue - if state.tasks_child_state.fail_state != self.FAILED_NONE: + if state.tasks_child_state and state.tasks_child_state.fail_state != self.FAILED_NONE: state.fail_state |= self.FAILED_RESCUE state.rescue_child_state = None state.cur_rescue_task += 1 @@ -293,7 +293,7 @@ class PlayIterator: if task is None: # check to see if the child state was failed, if so we need to # fail here too so we don't continue iterating always - if state.tasks_child_state.fail_state != self.FAILED_NONE: + if state.tasks_child_state and state.tasks_child_state.fail_state != self.FAILED_NONE: state.fail_state |= self.FAILED_ALWAYS state.always_child_state = None state.cur_always_task += 1