mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Re-allow vars on tasks, specifically for includes
This commit is contained in:
parent
0ad52a403f
commit
efcad3aa6d
1 changed files with 2 additions and 8 deletions
|
@ -68,22 +68,17 @@ class Task(Base, Conditional, Taggable, Become):
|
||||||
_failed_when = FieldAttribute(isa='string')
|
_failed_when = FieldAttribute(isa='string')
|
||||||
_first_available_file = FieldAttribute(isa='list')
|
_first_available_file = FieldAttribute(isa='list')
|
||||||
_ignore_errors = FieldAttribute(isa='bool')
|
_ignore_errors = FieldAttribute(isa='bool')
|
||||||
|
|
||||||
_loop = FieldAttribute(isa='string', private=True)
|
_loop = FieldAttribute(isa='string', private=True)
|
||||||
_loop_args = FieldAttribute(isa='list', private=True)
|
_loop_args = FieldAttribute(isa='list', private=True)
|
||||||
_local_action = FieldAttribute(isa='string')
|
_local_action = FieldAttribute(isa='string')
|
||||||
|
|
||||||
# FIXME: this should not be a Task
|
|
||||||
_meta = FieldAttribute(isa='string')
|
|
||||||
|
|
||||||
_name = FieldAttribute(isa='string', default='')
|
_name = FieldAttribute(isa='string', default='')
|
||||||
|
|
||||||
_notify = FieldAttribute(isa='list')
|
_notify = FieldAttribute(isa='list')
|
||||||
_poll = FieldAttribute(isa='int')
|
_poll = FieldAttribute(isa='int')
|
||||||
_register = FieldAttribute(isa='string')
|
_register = FieldAttribute(isa='string')
|
||||||
_retries = FieldAttribute(isa='int', default=1)
|
_retries = FieldAttribute(isa='int', default=1)
|
||||||
_run_once = FieldAttribute(isa='bool')
|
_run_once = FieldAttribute(isa='bool')
|
||||||
_until = FieldAttribute(isa='list') # ?
|
_until = FieldAttribute(isa='list') # ?
|
||||||
|
_vars = FieldAttribute(isa='dict', default=dict())
|
||||||
|
|
||||||
def __init__(self, block=None, role=None, task_include=None):
|
def __init__(self, block=None, role=None, task_include=None):
|
||||||
''' constructors a task, without the Task.load classmethod, it will be pretty blank '''
|
''' constructors a task, without the Task.load classmethod, it will be pretty blank '''
|
||||||
|
@ -91,7 +86,6 @@ 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__()
|
||||||
|
|
||||||
|
@ -194,7 +188,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:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue