mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixed environment inheritance
This commit is contained in:
parent
8aa732e0a4
commit
ae91cdfc98
3 changed files with 9 additions and 8 deletions
|
@ -310,11 +310,9 @@ class Block(Base, Become, Conditional, Taggable):
|
|||
'''
|
||||
Override for the 'tags' getattr fetcher, used from Base.
|
||||
'''
|
||||
environment = self._attributes['tags']
|
||||
environment = self._attributes['environment']
|
||||
if environment is None:
|
||||
environment = dict()
|
||||
|
||||
environment = self._get_parent_attribute('environment', extend=True)
|
||||
environment = self._get_parent_attribute('environment', extend=True)
|
||||
|
||||
return environment
|
||||
|
||||
|
|
|
@ -218,6 +218,9 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
Override post validation of vars on the play, as we don't want to
|
||||
template these too early.
|
||||
'''
|
||||
if value is None:
|
||||
return dict()
|
||||
|
||||
for env_item in value:
|
||||
if isinstance(env_item, (string_types, AnsibleUnicode)) and env_item in templar._available_variables.keys():
|
||||
self._display.deprecated("Using bare variables for environment is deprecated. Update your playbooks so that the environment value uses the full variable syntax ('{{foo}}')")
|
||||
|
@ -347,11 +350,9 @@ class Task(Base, Conditional, Taggable, Become):
|
|||
'''
|
||||
Override for the 'tags' getattr fetcher, used from Base.
|
||||
'''
|
||||
environment = self._attributes['tags']
|
||||
environment = self._attributes['environment']
|
||||
if environment is None:
|
||||
environment = dict()
|
||||
|
||||
environment = self._get_parent_attribute('environment', extend=True)
|
||||
environment = self._get_parent_attribute('environment')
|
||||
|
||||
return environment
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ class ActionBase:
|
|||
environments = [ environments ]
|
||||
|
||||
for environment in environments:
|
||||
if environment is None:
|
||||
continue
|
||||
if not isinstance(environment, dict):
|
||||
raise AnsibleError("environment must be a dictionary, received %s (%s)" % (environment, type(environment)))
|
||||
# very deliberatly using update here instead of combine_vars, as
|
||||
|
|
Loading…
Reference in a new issue