mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
parent
a1c38a3fda
commit
6dd38c2a10
3 changed files with 64 additions and 50 deletions
|
@ -105,7 +105,10 @@ class Base:
|
|||
if hasattr(self, method):
|
||||
return getattr(self, method)()
|
||||
|
||||
return self._attributes[prop_name]
|
||||
value = self._attributes[prop_name]
|
||||
if value is None and hasattr(self, '_get_parent_attribute'):
|
||||
value = self._get_parent_attribute(prop_name)
|
||||
return value
|
||||
|
||||
@staticmethod
|
||||
def _generic_s(prop_name, self, value):
|
||||
|
|
|
@ -271,7 +271,10 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
Generic logic to get the attribute or parent attribute for a block value.
|
||||
'''
|
||||
|
||||
value = None
|
||||
try:
|
||||
value = self._attributes[attr]
|
||||
|
||||
if self._parent_block and (value is None or extend):
|
||||
parent_value = getattr(self._parent_block, attr)
|
||||
if extend:
|
||||
|
@ -310,6 +313,8 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
value = self._extend_value(value, parent_value)
|
||||
else:
|
||||
value = parent_value
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return value
|
||||
|
||||
|
|
|
@ -363,7 +363,10 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
'''
|
||||
Generic logic to get the attribute or parent attribute for a task value.
|
||||
'''
|
||||
value = None
|
||||
try:
|
||||
value = self._attributes[attr]
|
||||
|
||||
if self._block and (value is None or extend):
|
||||
parent_value = getattr(self._block, attr)
|
||||
if extend:
|
||||
|
@ -376,6 +379,9 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
value = self._extend_value(value, parent_value)
|
||||
else:
|
||||
value = parent_value
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
return value
|
||||
|
||||
def _get_attr_environment(self):
|
||||
|
|
Loading…
Add table
Reference in a new issue