mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-24 22:00:22 -07:00
Fix any_errors_fatal incorrect implementation in 2.0
Also adds that flag to blocks. Fixes #13744
This commit is contained in:
parent
acf49cf837
commit
1825b4a9c7
5 changed files with 37 additions and 11 deletions
|
@ -35,6 +35,7 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
_always = FieldAttribute(isa='list', default=[])
|
||||
_delegate_to = FieldAttribute(isa='list')
|
||||
_delegate_facts = FieldAttribute(isa='bool', default=False)
|
||||
_any_errors_fatal = FieldAttribute(isa='bool')
|
||||
|
||||
# for future consideration? this would be functionally
|
||||
# similar to the 'else' clause for exceptions
|
||||
|
@ -330,6 +331,16 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
|
||||
return environment
|
||||
|
||||
def _get_attr_any_errors_fatal(self):
|
||||
'''
|
||||
Override for the 'tags' getattr fetcher, used from Base.
|
||||
'''
|
||||
any_errors_fatal = self._attributes['any_errors_fatal']
|
||||
if hasattr(self, '_get_parent_attribute'):
|
||||
if self._get_parent_attribute('any_errors_fatal'):
|
||||
any_errors_fatal = True
|
||||
return any_errors_fatal
|
||||
|
||||
def filter_tagged_tasks(self, play_context, all_vars):
|
||||
'''
|
||||
Creates a new block, with task lists filtered based on the tags contained
|
||||
|
|
|
@ -216,14 +216,6 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
|
||||
return super(Task, self).preprocess_data(new_ds)
|
||||
|
||||
def _load_any_errors_fatal(self, attr, value):
|
||||
'''
|
||||
Exists only to show a deprecation warning, as this attribute is not valid
|
||||
at the task level.
|
||||
'''
|
||||
display.deprecated("Setting any_errors_fatal on a task is no longer supported. This should be set at the play level only")
|
||||
return None
|
||||
|
||||
def post_validate(self, templar):
|
||||
'''
|
||||
Override of base class post_validate, to also do final validation on
|
||||
|
@ -422,3 +414,14 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
if parent_environment is not None:
|
||||
environment = self._extend_value(environment, parent_environment)
|
||||
return environment
|
||||
|
||||
def _get_attr_any_errors_fatal(self):
|
||||
'''
|
||||
Override for the 'tags' getattr fetcher, used from Base.
|
||||
'''
|
||||
any_errors_fatal = self._attributes['any_errors_fatal']
|
||||
if hasattr(self, '_get_parent_attribute'):
|
||||
if self._get_parent_attribute('any_errors_fatal'):
|
||||
any_errors_fatal = True
|
||||
return any_errors_fatal
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue