Remove vars attribute from base

Fixes #11779
pull/11776/merge
James Cammarata 9 years ago
parent 132c14eb57
commit 71867f9480

@ -47,8 +47,7 @@ class Base:
_port = FieldAttribute(isa='int') _port = FieldAttribute(isa='int')
_remote_user = FieldAttribute(isa='string') _remote_user = FieldAttribute(isa='string')
# vars and flags # flags and misc. settings
_vars = FieldAttribute(isa='dict', default=dict())
_environment = FieldAttribute(isa='list', default=[]) _environment = FieldAttribute(isa='list', default=[])
_no_log = FieldAttribute(isa='bool', default=False) _no_log = FieldAttribute(isa='bool', default=False)

@ -62,7 +62,6 @@ class Block(Base, Become, Conditional, Taggable):
if self._task_include: if self._task_include:
all_vars.update(self._task_include.get_vars()) all_vars.update(self._task_include.get_vars())
all_vars.update(self.vars)
return all_vars return all_vars
@staticmethod @staticmethod

@ -64,6 +64,7 @@ class Play(Base, Taggable, Become):
_name = FieldAttribute(isa='string', default='') _name = FieldAttribute(isa='string', default='')
# Variable Attributes # Variable Attributes
_vars = FieldAttribute(isa='dict', default=dict())
_vars_files = FieldAttribute(isa='list', default=[]) _vars_files = FieldAttribute(isa='list', default=[])
_vars_prompt = FieldAttribute(isa='list', default=[]) _vars_prompt = FieldAttribute(isa='list', default=[])
_vault_password = FieldAttribute(isa='string') _vault_password = FieldAttribute(isa='string')

@ -91,6 +91,7 @@ class Task(Base, Conditional, Taggable, Become):
self._block = block self._block = block
self._role = role self._role = role
self._task_include = task_include self._task_include = task_include
self._vars = dict()
super(Task, self).__init__() super(Task, self).__init__()
@ -193,7 +194,7 @@ class Task(Base, Conditional, Taggable, Become):
super(Task, self).post_validate(templar) super(Task, self).post_validate(templar)
def get_vars(self): def get_vars(self):
all_vars = self.vars.copy() all_vars = self._vars.copy()
if self._block: if self._block:
all_vars.update(self._block.get_vars()) all_vars.update(self._block.get_vars())
if self._task_include: if self._task_include:

@ -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"}}' 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: 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: test_vault:
ansible-playbook test_vault.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) --vault-password-file $(VAULT_PASSWORD_FILE) --list-tasks ansible-playbook test_vault.yml -i $(INVENTORY) $(CREDENTIALS_ARG) -v $(TEST_FLAGS) --vault-password-file $(VAULT_PASSWORD_FILE) --list-tasks

Loading…
Cancel
Save