mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix the way we re-add variables from PlayContext to the variable dict
* If the internal value is None, do not add the variable * Make sure all aliases for a given variable name are set (if they're not already set in the dictionary) Fixes #14310
This commit is contained in:
parent
e2a7ba35db
commit
75b6f61619
1 changed files with 6 additions and 8 deletions
|
@ -524,11 +524,9 @@ class PlayContext(Base):
|
||||||
In case users need to access from the play, this is a legacy from runner.
|
In case users need to access from the play, this is a legacy from runner.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# TODO: should we be setting the more generic values here rather than
|
for prop, var_list in MAGIC_VARIABLE_MAPPING.items():
|
||||||
# the more specific _ssh_ ones?
|
var_val = getattr(self, prop, None)
|
||||||
for special_var in RESET_VARS:
|
if var_val is not None:
|
||||||
|
for var_opt in var_list:
|
||||||
if special_var not in variables:
|
if var_opt not in variables:
|
||||||
for prop, varnames in MAGIC_VARIABLE_MAPPING.items():
|
variables[var_opt] = var_val
|
||||||
if special_var in varnames:
|
|
||||||
variables[special_var] = getattr(self, prop)
|
|
||||||
|
|
Loading…
Reference in a new issue