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

Improve messages when module/action loading fails after a redirect #73603

Closed

Conversation

felixfontein
Copy link
Contributor

@felixfontein felixfontein commented Feb 14, 2021

SUMMARY

I've added a broken redirect community.docker.docker_containercommunity.dockerx.docker_container to investigate reports that the error messages are not helpful. The error message ansible produces is great. But ansible-doc and ansible-playbook are not helpful. This PR improves that a bit.

  • ansible-doc now says

    [WARNING]: module docker_container was redirected to community.dockerx.docker_container, which was not found in XXX
    

    instead of

    [WARNING]: module docker_container not found in: XXX
    
  • ansible-playbook now says

    ERROR! module/action 'docker_container' was redirected to 'community.dockerx.docker_container', which could not be loaded.
    

    instead of

    ERROR! couldn't resolve module/action 'docker_container'. This often indicates a misspelling, missing collection, or incorrect module path.
    
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

core

@ansibot ansibot added affects_2.11 bug This issue/PR relates to a bug. core_review In order to be merged, this PR must follow the core review workflow. needs_triage Needs a first human triage before being processed. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Feb 14, 2021
@felixfontein
Copy link
Contributor Author

felixfontein commented Feb 14, 2021

For lookups:

after:

fatal: [localhost]: FAILED! => {"msg": "lookup plugin 'community.docker.docker_container' was redirected to 'community.dockerx.docker_container', which could not be loaded"}

before:

fatal: [localhost]: FAILED! => {"msg": "lookup plugin (community.docker.docker_container) not found"}

@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. core_review In order to be merged, this PR must follow the core review workflow. and removed core_review In order to be merged, this PR must follow the core review workflow. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Feb 14, 2021
@felixfontein
Copy link
Contributor Author

I also tried to improve the messages for filter and test plugins, but the code there is somewhat strange - I have some doubts it will work for multi-stage redirects, and I was not able to change the error message in any way without removing the error and making debug output the untemplated expression...

I guess similar problems also happen for many other plugin types... Maybe a more unified mechanism for reporting such errors would be helpful :)

@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Feb 17, 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 Feb 25, 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 2, 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 Mar 10, 2021
lib/ansible/cli/doc.py Outdated Show resolved Hide resolved
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. core_review In order to be merged, this PR must follow the core review workflow. labels Mar 27, 2021
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 28, 2021
@ansibot
Copy link
Contributor

ansibot commented Mar 28, 2021

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

lib/ansible/parsing/mod_args.py:339:49: E121: continuation line under-indented for hanging indent

click here for bot help

@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 core_review In order to be merged, this PR must follow the core review workflow. labels Mar 28, 2021
@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed 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. core_review In order to be merged, this PR must follow the core review workflow. labels Mar 28, 2021
@felixfontein
Copy link
Contributor Author

/rebuild_failed

@ansibot ansibot added core_review In order to be merged, this PR must follow the core review workflow. and removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 28, 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 5, 2021
@ansibot ansibot added needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Jun 8, 2021
@felixfontein felixfontein deleted the improve-error-messages branch November 4, 2021 18:58
@ansible ansible locked and limited conversation to collaborators Nov 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.11 bug This issue/PR relates to a bug. needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants