Skip to content

Conversation

@yurnov
Copy link
Contributor

@yurnov yurnov commented Oct 21, 2025

SUMMARY

Using exit_json or fail_json for warnings is deprecated in ansible-core>=2.19.0 and will be removed in ansible-core>=2.23.0

Tested with ansible-core 2.19.3 as the latest released version at the time of commit and with 2.16.0 as the lowest version supported by kubernetes.core 6.x

Resolves: #1031

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

k8s_drain
k8s_rollback
k8s_scale

ADDITIONAL INFORMATION

The initial version of this PR covers only the module k8s_drain, with the following commits extended to k8s_rollback
k8s_scale

@softwarefactory-project-zuul
Copy link

@yurnov
Copy link
Contributor Author

yurnov commented Oct 21, 2025

Unclear why I got the following in linter, but it's not related to my commit/PR:

Error: : Unable to parse documentation in python file 'plugins/modules/k8s_exec.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_scale.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_json_patch.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/lookup/kustomize.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_service.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_taint.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/connection/kubectl.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_cluster_info.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_plugin_info.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/lookup/k8s.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_info.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_log.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_registry_auth.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_drain.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_template.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_pull.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_cp.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_rollback.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_plugin.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/helm_repository.py': The `src` field must be an absolute path..
Error: : Unable to parse documentation in python file 'plugins/modules/k8s_info.py': The `src` field must be an absolute path..

@yurnov yurnov changed the title Replace passing warnings to exit_json with AnsibleModule.warn for module k8s_drain Replace passing warnings to exit_json with AnsibleModule.warn for the few modules Oct 22, 2025
@softwarefactory-project-zuul
Copy link

@softwarefactory-project-zuul
Copy link

@yurnov yurnov force-pushed the use_module.warn_for_warnings branch from 89a2e2f to babbdcc Compare October 22, 2025 11:13
@softwarefactory-project-zuul
Copy link

@yurnov yurnov force-pushed the use_module.warn_for_warnings branch from babbdcc to ad7cc0c Compare October 24, 2025 09:00
@softwarefactory-project-zuul
Copy link

This commit covers only module k8s_drain

Using exit_json or fail_json for warningns is deprecated in
ansible-core>=2.19.0 and will be removed in ansible-core>=2.23.0

Tested with ansible-core 2.19.3 as the latest released version
on the time of commit and with 2.16.0 as the loverst version
supported by kubernetes.core 6.x

Resolves: ansible-collections#1031
@yurnov yurnov force-pushed the use_module.warn_for_warnings branch from ad7cc0c to d98f951 Compare October 24, 2025 09:52
@softwarefactory-project-zuul
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

k8s_drain ansible 2.19: Deprecation warning: Passing warnings to exit_json or fail_json is deprecated.

1 participant