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

[POC] Support unpacking loop vars #74259

Draft
wants to merge 1 commit into
base: devel
Choose a base branch
from
Draft

Conversation

sivel
Copy link
Member

@sivel sivel commented Apr 13, 2021

SUMMARY

This PR injects the loop items directly into the "global" scope of task vars, while also keeping it available under loop_var

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

lib/ansible/executor/task_executor.py

ADDITIONAL INFORMATION
- name: TEST LOOP CONTROL LABEL
  hosts: localhost
  gather_facts: no
  tasks:
    - debug: var=foo
      loop:
        - foo: bar
        - foo: baz
        - foo: qux
      loop_control:
        unpack: true

TODO:

  • Probably need to validate the type of the var to ensure it is a mapping when unpack=True

@ansibot ansibot added WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. affects_2.12 feature This issue/PR relates to a feature request. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Apr 13, 2021
@sivel sivel changed the title [POC] Support spreading loop vars [POC] Support spreading/unpacking loop vars Apr 15, 2021
@jborean93 jborean93 removed the needs_triage Needs a first human triage before being processed. label Apr 15, 2021
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 23, 2021
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 22, 2022
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 30, 2022
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Jun 18, 2022
@sivel sivel added the fallible This issue/PR is a candidate for fallible label Sep 1, 2022
@sivel sivel changed the title [POC] Support spreading/unpacking loop vars [POC] Support unpacking loop vars Sep 7, 2022
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Sep 7, 2022
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Sep 15, 2022
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Sep 21, 2022
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 29, 2022
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 17, 2022
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 25, 2022
@djdanielsson
Copy link

is there any status on if this PR will be accepted? This seems like a great feature to offer

@sivel
Copy link
Member Author

sivel commented Jan 9, 2023

is there any status on if this PR will be accepted? This seems like a great feature to offer

This feature has been included in the experimental fallible (https://pypi.org/project/fallible/) build, and we are waiting on feedback about the feature, to determine if it should be included within ansible-core. See this presentation for more information: https://youtu.be/DCf_e6XRsCw?t=7924

@djdanielsson
Copy link

Yes I know about that, where are you looking for feedback? In this PR or somewhere else?

@sivel
Copy link
Member Author

sivel commented Jan 9, 2023

Yes I know about that, where are you looking for feedback? In this PR or somewhere else?

Feedback should be provided on the individual PRs. In this case, right here is expected.

@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Feb 28, 2023
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Mar 30, 2023
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 12, 2023
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Apr 20, 2023
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html labels Oct 24, 2023
@ansibot ansibot added ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jun 12, 2024
@ansibot
Copy link
Contributor

ansibot commented Jun 12, 2024

The test ansible-test sanity --test pylint [explain] failed with 1 error:

lib/ansible/executor/task_executor.py:301:40: undefined-variable: Undefined variable 'Mapping'

click here for bot help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.12 ci_verified Changes made in this PR are causing tests to fail. fallible This issue/PR is a candidate for fallible feature This issue/PR relates to a feature request. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. support:core This issue/PR relates to code supported by the Ansible Engineering Team. WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants