mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-09 23:00:02 -07: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.
|
Override for the 'tags' getattr fetcher, used from Base.
|
||||||
'''
|
'''
|
||||||
environment = self._attributes['tags']
|
environment = self._attributes['environment']
|
||||||
if environment is None:
|
if environment is None:
|
||||||
environment = dict()
|
environment = self._get_parent_attribute('environment', extend=True)
|
||||||
|
|
||||||
environment = self._get_parent_attribute('environment', extend=True)
|
|
||||||
|
|
||||||
return environment
|
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
|
Override post validation of vars on the play, as we don't want to
|
||||||
template these too early.
|
template these too early.
|
||||||
'''
|
'''
|
||||||
|
if value is None:
|
||||||
|
return dict()
|
||||||
|
|
||||||
for env_item in value:
|
for env_item in value:
|
||||||
if isinstance(env_item, (string_types, AnsibleUnicode)) and env_item in templar._available_variables.keys():
|
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}}')")
|
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.
|
Override for the 'tags' getattr fetcher, used from Base.
|
||||||
'''
|
'''
|
||||||
environment = self._attributes['tags']
|
environment = self._attributes['environment']
|
||||||
if environment is None:
|
if environment is None:
|
||||||
environment = dict()
|
environment = self._get_parent_attribute('environment')
|
||||||
|
|
||||||
environment = self._get_parent_attribute('environment', extend=True)
|
|
||||||
|
|
||||||
return environment
|
return environment
|
||||||
|
|
||||||
|
|
|
@ -116,6 +116,8 @@ class ActionBase:
|
||||||
environments = [ environments ]
|
environments = [ environments ]
|
||||||
|
|
||||||
for environment in environments:
|
for environment in environments:
|
||||||
|
if environment is None:
|
||||||
|
continue
|
||||||
if not isinstance(environment, dict):
|
if not isinstance(environment, dict):
|
||||||
raise AnsibleError("environment must be a dictionary, received %s (%s)" % (environment, type(environment)))
|
raise AnsibleError("environment must be a dictionary, received %s (%s)" % (environment, type(environment)))
|
||||||
# very deliberatly using update here instead of combine_vars, as
|
# very deliberatly using update here instead of combine_vars, as
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue