ansible / vscode-ansible

vscode/vscodium extension for providing Ansible auto-completion and integrating quality assurance tools like ansible-lint, ansible syntax check, yamllint, molecule and ansible-test.
https://ansible.readthedocs.io/projects/vscode-ansible/
MIT License
360 stars 86 forks source link

No Problem found when ansible-lint is actually returning fatal "couldn't resolve module" violation #1327

Closed Snowman-25 closed 2 months ago

Snowman-25 commented 4 months ago

Summary

I'm in the process of moving hosts and updating ansible-versions and playbooks. Due to modules being migrated to galaxy, one of my playbooks has unresolved modules/actions (namely timezone and alternatives). Running ansible-lint against the playbook also shows the relevant output:

WARNING  Listing 1 violation(s) that are fatal
syntax-check[unknown-module]: couldn't resolve module/action 'alternatives'. This often indicates a misspelling, missing collection, or incorrect module path.
common/ubuntu/basic-setup.yml:131:11

                     Rule Violation Summary
 count tag                          profile rule associated tags
     1 syntax-check[unknown-module] min     core, unskippable

Failed: 1 failure(s), 0 warning(s) on 1 files.

This, however isn't shown in the Problems-pane of VSCode. It behaves as if there are no errors at all!

Sidenote: After installing the correct module into my collection, ansible-lint inside vscode works as expected.

The Playbook is incorrectly being marked as having no problem, when it couldn't be further from the truth!

Extension version

24.5.2

VS Code version

1.89.1

Ansible Version

ansible [core 2.17.0]
  config file = /root/.ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /root/.local/share/pipx/venvs/ansible-core/lib/python3.12/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /root/.local/bin/ansible
  python version = 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] (/root/.local/share/pipx/venvs/ansible-core/bin/python)
  jinja version = 3.1.4
  libyaml = True

OS / Environment

Relevant log output

Path for lint: /root/.local/bin/ansible-lint
Validating using ansible-lint
Path for lint: /root/.local/bin/ansible-lint
Validating using ansible-lint
Path for lint: /root/.local/bin/ansible-lint
Validating using ansible-lint
priyamsahoo commented 4 months ago

Hi @Snowman-25, the fix for this problem is merged (pr#1317), and it should work fine in the next release of the extension.