From 9a6ae1d62a773285c23cc095f43d91ef86112f6e Mon Sep 17 00:00:00 2001 From: Christoph Dittmann Date: Wed, 2 Dec 2015 10:54:28 +0100 Subject: [PATCH] Let PlayIterator.add_tasks accept empty task lists PlayIterator.add_tasks raised an error when trying to add an empty task list. This was the root cause of ansible issue #13370. --- lib/ansible/executor/play_iterator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/ansible/executor/play_iterator.py b/lib/ansible/executor/play_iterator.py index fd59478ead9..23ba52edf93 100644 --- a/lib/ansible/executor/play_iterator.py +++ b/lib/ansible/executor/play_iterator.py @@ -399,6 +399,9 @@ class PlayIterator: if state.fail_state != self.FAILED_NONE: return state + if not task_list: + return state + if state.run_state == self.ITERATING_TASKS: if state.tasks_child_state: state.tasks_child_state = self._insert_tasks_into_state(state.tasks_child_state, task_list)