From d07107ab71ea60f174fac40681cd7b30e88a33ab Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Mon, 11 Aug 2014 13:13:48 -0500 Subject: [PATCH] Remove duplicate compiling of task when: statements Fixes #8538 --- lib/ansible/playbook/play.py | 6 ------ lib/ansible/playbook/task.py | 5 +++-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index 2a1d570c7e7..f665ed76d20 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -561,12 +561,6 @@ class Play(object): if 'vars' in x: task_vars = utils.combine_vars(task_vars, x['vars']) - if 'when' in x: - if isinstance(x['when'], (basestring, bool)): - included_additional_conditions.append(x['when']) - elif isinstance(x['when'], list): - included_additional_conditions.extend(x['when']) - new_role = None if 'role_name' in x: new_role = x['role_name'] diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index 1148e7454c3..793e29ec5fb 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -300,6 +300,7 @@ class Task(object): self.tags.extend(import_tags) if additional_conditions: - new_conditions = additional_conditions - new_conditions.append(self.when) + new_conditions = additional_conditions[:] + if self.when: + new_conditions.append(self.when) self.when = new_conditions