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
loop_control/label shows wrong value when referencing task-level var #38899
Comments
Files identified in the description: If these files are inaccurate, please update the |
I encountered this same issue in 2.4.4 after upgrading from 2.4.2 due to a memory issue (2.4.2 displayed the labels correctly). The playbook I found this in was a lot more complicated, but by experimenting I was able to satisfy myself that only the label was displayed incorrectly. The loop variable items still seem to be correct in the underlying data, and actions using that data appear correct. I tested the example above with addition of a register, so that the internal loop data can be seen. From this it is clear that "_ansible_item_label" should be changed but isn't. (However, I'm unsure about the other "_ansible.." loop variables - in this simple example, the values are the same for each item.) Hopefully this helps: Modified playbook - hosts: localhost
gather_facts: no
tasks:
- name: test stuff
vars:
foo: '{{ item|int }}'
debug:
var: foo
with_sequence: start=1 count=3
loop_control:
label: '{{ foo }}'
register: baz
- name: show stuff
debug:
var: baz Results
|
I'm on 2.4.4 as well, and see this when using Playbook
Actual Results
Expected Results
|
@bcoca do you know what changed that is causing this? You indicated on IRC that it probably had something to do with task-level vars caching. |
A git bisect indicates that this was caused be 4546e7d |
It seems to be the side effect of moving |
That seems to fit with what bcoca had said on IRC. The previous code re-instantiated the Templar class on each loop iteration, but now it only happens once for the task. |
This could probably be fixed by just bringing back the line to re-instantiate the |
) (ansible#39818) (cherry picked from commit 01e8139)
) (ansible#39818) (cherry picked from commit 01e8139)
ISSUE TYPE
COMPONENT NAME
loop_control/label
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
N/A
SUMMARY
When using the
loop_control
/label
feature and referencing a task-level var, the var seems to be evaluated only once.STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
The text was updated successfully, but these errors were encountered: