From 71867f9480133de3123ff23519423d0177240970 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 29 Jul 2015 09:45:08 -0400 Subject: [PATCH] Remove vars attribute from base Fixes #11779 --- lib/ansible/playbook/base.py | 3 +-- lib/ansible/playbook/block.py | 1 - lib/ansible/playbook/play.py | 1 + lib/ansible/playbook/task.py | 3 ++- test/integration/Makefile | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/ansible/playbook/base.py b/lib/ansible/playbook/base.py index 3205ce4f0d..48f62b57df 100644 --- a/lib/ansible/playbook/base.py +++ b/lib/ansible/playbook/base.py @@ -47,8 +47,7 @@ class Base: _port = FieldAttribute(isa='int') _remote_user = FieldAttribute(isa='string') - # vars and flags - _vars = FieldAttribute(isa='dict', default=dict()) + # flags and misc. settings _environment = FieldAttribute(isa='list', default=[]) _no_log = FieldAttribute(isa='bool', default=False) diff --git a/lib/ansible/playbook/block.py b/lib/ansible/playbook/block.py index 3d3e78166e..7bba9f325c 100644 --- a/lib/ansible/playbook/block.py +++ b/lib/ansible/playbook/block.py @@ -62,7 +62,6 @@ class Block(Base, Become, Conditional, Taggable): if self._task_include: all_vars.update(self._task_include.get_vars()) - all_vars.update(self.vars) return all_vars @staticmethod diff --git a/lib/ansible/playbook/play.py b/lib/ansible/playbook/play.py index ca043e462b..7718201daf 100644 --- a/lib/ansible/playbook/play.py +++ b/lib/ansible/playbook/play.py @@ -64,6 +64,7 @@ class Play(Base, Taggable, Become): _name = FieldAttribute(isa='string', default='') # Variable Attributes + _vars = FieldAttribute(isa='dict', default=dict()) _vars_files = FieldAttribute(isa='list', default=[]) _vars_prompt = FieldAttribute(isa='list', default=[]) _vault_password = FieldAttribute(isa='string') diff --git a/lib/ansible/playbook/task.py b/lib/ansible/playbook/task.py index ca163ca7e5..bf7e089793 100644 --- a/lib/ansible/playbook/task.py +++ b/lib/ansible/playbook/task.py @@ -91,6 +91,7 @@ class Task(Base, Conditional, Taggable, Become): self._block = block self._role = role self._task_include = task_include + self._vars = dict() super(Task, self).__init__() @@ -193,7 +194,7 @@ class Task(Base, Conditional, Taggable, Become): super(Task, self).post_validate(templar) def get_vars(self): - all_vars = self.vars.copy() + all_vars = self._vars.copy() if self._block: all_vars.update(self._block.get_vars()) if self._task_include: diff --git a/test/integration/Makefile b/test/integration/Makefile index 04953ee23c..af1bee3201 100644 --- a/test/integration/Makefile +++ b/test/integration/Makefile @@ -73,7 +73,7 @@ test_hash: ANSIBLE_HASH_BEHAVIOUR=merge ansible-playbook test_hash.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e '{"test_hash":{"extra_args":"this is an extra arg"}}' test_var_precedence: - ansible-playbook test_var_precedence.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v -e 'extra_var=extra_var' -e 'extra_var_override=extra_var_override' + ansible-playbook test_var_precedence.yml -i $(INVENTORY) $(CREDENTIALS_ARG) $(TEST_FLAGS) -v -e 'extra_var=extra_var' -e 'extra_var_override=extra_var_override' test_vault: ansible-playbook test_vault.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) --vault-password-file $(VAULT_PASSWORD_FILE) --list-tasks