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
Sanitize debug var= tasks of the loop variable #66269
base: devel
Are you sure you want to change the base?
Conversation
@@ -263,6 +263,10 @@ def _clean_results(self, result, task_name): | |||
# 'var' value as field, so eliminate others and what is left should be varname | |||
for hidme in self._hide_in_debug: | |||
result.pop(hidme, None) | |||
# when using loop control, remove whatever is under loop_var | |||
if 'ansible_loop_var' in result: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to do the same for ansible_index_var
variable too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good call, added that to the test playbook and found it show up. Pushing change now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, any var that is not the 'item' in vars= should be removed
I found that this afflicts Ansible 2.9 as well, since it's a bug fix, I'm going to add the changelog |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
SUMMARY
Proposed fix for #65856
ISSUE TYPE
COMPONENT NAME
debug
ADDITIONAL INFORMATION
I have a test case for this, modeled after
ansible/test/integration/targets/loop_control/runme.sh
Line 10 in 495c197
(you have to manually inspect the exit code in that case)
inside runme.sh
inside loop_test.yml
I am less confident about integrating this into the tests, although there really shouldn't be a problem with it.
and I confirm exit code 1 with devel and exit code 0 with this patch.