ansible-lint icon indicating copy to clipboard operation
ansible-lint copied to clipboard

Capture and process Ansible DeprecationWarning exceptions

Open ssbarnea opened this issue 4 years ago • 2 comments

Issue Type

  • Feature request

Desired Behaviour

Ansible can raise various DeprecationWarning exceptions while called by ansible-lint, and we should capture these and raise them as linting errors.

Rationale: the linting is the best place to raise these as errors because it does not run in production. In many cases users may even disable warnings in Ansible for deployments.

Obviously that when implemented as a rule, we should be able disable it just like the others.

Current Behaviour

Warnings can be seen on screen but the linter has no clue about them and the final result is still a success.

Examples:

[DEPRECATION WARNING]: os_server_facts is kept for backwards compatibility but
usage is discouraged. The module documentation details page may explain more
about this rationale.. This feature will be removed in a future release.
Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.

[DEPRECATION WARNING]: os_subnets_facts is kept for backwards compatibility but
 usage is discouraged. The module documentation details page may explain more
about this rationale.. This feature will be removed in a future release.
Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.

[DEPRECATION WARNING]: os_port_facts is kept for backwards compatibility but
usage is discouraged. The module documentation details page may explain more
about this rationale.. This feature will be removed in a future release.
Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.

ssbarnea avatar Nov 05 '19 09:11 ssbarnea

Possible dupes: #246, #429.

webknjaz avatar Apr 25 '20 23:04 webknjaz

Are there any updates on this issue. Is it possible to add the deprecation warnings as linting errors? Or are these warnings still not collectible from Ansible-core as stated here https://github.com/ansible/ansible-lint/issues/246#issuecomment-690120328?

I also see in the ansible-lint docs there is a section for deprecated-module rules https://ansible.readthedocs.io/projects/lint/rules/deprecated-module/ but this issue describes ansible-lint not being able to detect deprecated modules. Should this be included in the documentation if it is currently not supported or is there a case where ansible-lint can detect deprecated modules?

prat98 avatar Aug 02 '23 20:08 prat98