ansible-lint
ansible-lint copied to clipboard
Capture and process Ansible DeprecationWarning exceptions
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.
Possible dupes: #246, #429.
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?