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

Update playbook_executor.py #80594

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

Update playbook_executor.py #80594

wants to merge 1 commit into from

Conversation

sobngwi
Copy link

@sobngwi sobngwi commented Apr 21, 2023

Wrong error message is display when the ansible-playbook command is lauch with the option option --start-at-task 'yy'

SUMMARY

I tried to import tasks in a play book with the import_tasks:

- name: yy
   import_tasks: import_tasks.yaml
   when: import_tasks_var is not defined

Here is the content of the file import_tasks.yaml:

- set_fact:
      import_tasks_var: foo
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

import_tasks

ADDITIONAL INFORMATION

Create a playbook named p1.yml with a task:

- name: yy
   import_tasks: import_tasks.yaml
   when: import_tasks_var is not defined

Here is the content of the file import_tasks.yaml:

- set_fact:
      import_tasks_var: foo

Run your play book p1.yml with option --start-at-task 'yy'

as import_tasks is static, the wrong message error below is displayed :

[ERROR]: No matching task "yy" found. Note: --start-at-task can only follow static includes.
 ansible-playbook p1.yml --step --start-at-task 'yy'

Wrong error message is display.
@ansibot ansibot added affects_2.16 bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. small_patch labels Apr 21, 2023
@@ -265,7 +265,7 @@ def run(self):
if context.CLIARGS['start_at_task'] and not self._tqm._start_at_done:
display.error(
"No matching task \"%s\" found."
" Note: --start-at-task can only follow static includes."
" Note: --start-at-task can only follow dynamic includes."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not really correct but the current wording is confusing (git blame'ed to my commit ;-) ).

I believe by "following static includes" it is meant that --start-at-task can target tasks within static includes.

So the message should be wordsmithed to contain the following information, --start-at-task:

  • can target tasks within static includes
  • cannot target tasks within dynamic includes
  • can target the dynamic include task itself
  • cannot target the static include task itself

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To explain the above, static includes (imports) are removed and replaced with the imported tasks when compiling the playbook so by the time you get here, they don't exist, but the imported tasks do exist.

On the contrary dynamic includes (include_X) exist at this point and have not been processed yet, so the 'future included tasks' are not accessible but the include itself is.

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Apr 21, 2023
@mkrizek mkrizek added docs This issue/PR relates to or includes documentation. and removed needs_triage Needs a first human triage before being processed. labels Apr 25, 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 May 3, 2023
@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jun 20, 2023
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Jul 12, 2023
@nitzmahone nitzmahone added the P3 Priority 3 - Approved, No Time Limitation label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.16 bug This issue/PR relates to a bug. docs This issue/PR relates to or includes documentation. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_contributor This PR is the first contribution by a new community member. P3 Priority 3 - Approved, No Time Limitation small_patch stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants