1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix issue when var name is the same as content.

See https://github.com/ansible/ansible/issues/13453 for more details.
This commit is contained in:
Yannig Perré 2015-12-07 09:25:37 +01:00
parent 8607aa527d
commit 2c8eee956f

View file

@ -45,8 +45,12 @@ class ActionModule(ActionBase):
# If var is a list or dict, use the type as key to display # If var is a list or dict, use the type as key to display
result[to_unicode(type(self._task.args['var']))] = results result[to_unicode(type(self._task.args['var']))] = results
else: else:
# If var name is same as result, try to template it
if results == self._task.args['var']: if results == self._task.args['var']:
results = "VARIABLE IS NOT DEFINED!" try:
results = self._templar.template("{{" + results + "}}", convert_bare=True, fail_on_undefined=True)
except:
results = "VARIABLE IS NOT DEFINED!"
result[self._task.args['var']] = results result[self._task.args['var']] = results
else: else:
result['msg'] = 'here we are' result['msg'] = 'here we are'