Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue when var name is the same as content. #13455

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/ansible/plugins/action/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,12 @@ def run(self, tmp=None, task_vars=None):
# If var is a list or dict, use the type as key to display
result[to_unicode(type(self._task.args['var']))] = results
else:
# If var name is same as result, try to template it
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
else:
result['msg'] = 'here we are'
Expand Down