mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-10-09 18:04:02 -07:00
parent
2f33c1a1a1
commit
5553b20828
206 changed files with 1853 additions and 1870 deletions
|
@ -28,29 +28,30 @@ from ansible.playbook.helpers import load_list_of_tasks
|
|||
from ansible.playbook.role import Role
|
||||
from ansible.playbook.taggable import Taggable
|
||||
|
||||
|
||||
class Block(Base, Become, Conditional, Taggable):
|
||||
|
||||
# main block fields containing the task lists
|
||||
_block = FieldAttribute(isa='list', default=[], inherit=False)
|
||||
_rescue = FieldAttribute(isa='list', default=[], inherit=False)
|
||||
_always = FieldAttribute(isa='list', default=[], inherit=False)
|
||||
_block = FieldAttribute(isa='list', default=[], inherit=False)
|
||||
_rescue = FieldAttribute(isa='list', default=[], inherit=False)
|
||||
_always = FieldAttribute(isa='list', default=[], inherit=False)
|
||||
|
||||
# other fields
|
||||
_delegate_to = FieldAttribute(isa='string')
|
||||
_delegate_facts = FieldAttribute(isa='bool', default=False)
|
||||
_name = FieldAttribute(isa='string', default='')
|
||||
_delegate_to = FieldAttribute(isa='string')
|
||||
_delegate_facts = FieldAttribute(isa='bool', default=False)
|
||||
_name = FieldAttribute(isa='string', default='')
|
||||
|
||||
# for future consideration? this would be functionally
|
||||
# similar to the 'else' clause for exceptions
|
||||
#_otherwise = FieldAttribute(isa='list')
|
||||
# _otherwise = FieldAttribute(isa='list')
|
||||
|
||||
def __init__(self, play=None, parent_block=None, role=None, task_include=None, use_handlers=False, implicit=False):
|
||||
self._play = play
|
||||
self._role = role
|
||||
self._parent = None
|
||||
self._dep_chain = None
|
||||
self._play = play
|
||||
self._role = role
|
||||
self._parent = None
|
||||
self._dep_chain = None
|
||||
self._use_handlers = use_handlers
|
||||
self._implicit = implicit
|
||||
self._implicit = implicit
|
||||
|
||||
# end of role flag
|
||||
self._eor = False
|
||||
|
@ -182,9 +183,9 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
return new_task_list
|
||||
|
||||
new_me = super(Block, self).copy()
|
||||
new_me._play = self._play
|
||||
new_me._play = self._play
|
||||
new_me._use_handlers = self._use_handlers
|
||||
new_me._eor = self._eor
|
||||
new_me._eor = self._eor
|
||||
|
||||
if self._dep_chain is not None:
|
||||
new_me._dep_chain = self._dep_chain[:]
|
||||
|
@ -194,7 +195,7 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
new_me._parent = self._parent.copy(exclude_tasks=exclude_tasks)
|
||||
|
||||
if not exclude_tasks:
|
||||
new_me.block = _dupe_task_list(self.block or [], new_me)
|
||||
new_me.block = _dupe_task_list(self.block or [], new_me)
|
||||
new_me.rescue = _dupe_task_list(self.rescue or [], new_me)
|
||||
new_me.always = _dupe_task_list(self.always or [], new_me)
|
||||
|
||||
|
@ -355,7 +356,7 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
|
||||
def evaluate_block(block):
|
||||
new_block = self.copy(exclude_tasks=True)
|
||||
new_block.block = evaluate_and_append_task(block.block)
|
||||
new_block.block = evaluate_and_append_task(block.block)
|
||||
new_block.rescue = evaluate_and_append_task(block.rescue)
|
||||
new_block.always = evaluate_and_append_task(block.always)
|
||||
return new_block
|
||||
|
@ -385,4 +386,3 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
return self._parent.all_parents_static()
|
||||
|
||||
return True
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue