From cb00cf3c9ea61aaf35043974314071d7d1d39206 Mon Sep 17 00:00:00 2001 From: Don Naro Date: Mon, 14 Sep 2026 13:29:16 +0100 Subject: [PATCH] Address stale deprecations (#1240) * chore: update deprecation for wait_timeout * chore: update deprecation for return_code * docs(changelogs): add stale deprecations to changelogs * docs: ignore pylint deprecation warnings * chore: update deprecation for merge_type * docs: update changelogs for merge_type * docs: ignore more pylint deprecation warnings --- .../fragments/20260911-update-deprecation-notices.yaml | 8 ++++++++ plugins/modules/helm.py | 10 +++++++++- plugins/modules/k8s_exec.py | 9 ++++++++- plugins/modules/k8s_service.py | 10 ++++++++++ tests/sanity/ignore-2.16.txt | 3 +++ tests/sanity/ignore-2.17.txt | 3 +++ tests/sanity/ignore-2.18.txt | 3 +++ 7 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/20260911-update-deprecation-notices.yaml diff --git a/changelogs/fragments/20260911-update-deprecation-notices.yaml b/changelogs/fragments/20260911-update-deprecation-notices.yaml new file mode 100644 index 00000000..96c86c77 --- /dev/null +++ b/changelogs/fragments/20260911-update-deprecation-notices.yaml @@ -0,0 +1,8 @@ +--- +deprecated_features: + - helm - the ``wait_timeout`` parameter has been deprecated and will be removed in version 7.0.0. + Use ``timeout`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239). + - k8s_exec - the ``return_code`` return value has been deprecated and will be removed in version 7.0.0. + Use ``rc`` instead (https://github.com/ansible-collections/kubernetes.core/issues/1239). + - k8s_service - the ``merge_type=json`` option has been deprecated and will be removed in version 7.0.0. + Use ``kubernetes.core.k8s_json_patch`` module instead (https://github.com/ansible-collections/kubernetes.core/issues/1239). diff --git a/plugins/modules/helm.py b/plugins/modules/helm.py index 87449089..ef163de3 100644 --- a/plugins/modules/helm.py +++ b/plugins/modules/helm.py @@ -199,7 +199,7 @@ options: wait_timeout: description: - Timeout when wait option is enabled (helm2 is a number of seconds, helm3 is a duration). - - The use of I(wait_timeout) to wait for kubernetes commands to complete has been deprecated and will be removed after 2022-12-01. + - The use of I(wait_timeout) to wait for kubernetes commands to complete has been deprecated and will be removed in version 7.0.0. Use O(timeout) instead. type: str timeout: description: @@ -1061,6 +1061,14 @@ def main(): supports_check_mode=True, ) + # Add deprecation warning for wait_timeout + if module.params.get("wait_timeout") is not None: + module.deprecate( + "The 'wait_timeout' parameter is deprecated and will be removed in version 7.0.0. Use 'timeout' instead.", + version="7.0.0", + collection_name="kubernetes.core", + ) + if not IMP_YAML: module.fail_json(msg=missing_required_lib("yaml"), exception=IMP_YAML_ERR) diff --git a/plugins/modules/k8s_exec.py b/plugins/modules/k8s_exec.py index 86ebe775..70ef9683 100644 --- a/plugins/modules/k8s_exec.py +++ b/plugins/modules/k8s_exec.py @@ -118,7 +118,7 @@ result: type: int version_added: 2.2.0 return_code: - description: The command status code. This attribute is deprecated and will be removed in a future release. Please use rc instead. + description: The command status code. This attribute is deprecated and will be removed in version 7.0.0. Use RV(result.rc) instead. type: int """ @@ -219,6 +219,13 @@ def execute_module(module, client): else: rc = int(err["details"]["causes"][0]["message"]) + # Add deprecation warning for return_code return value + module.deprecate( + "The 'return_code' return value is deprecated and will be removed in version 7.0.0. Use 'rc' instead.", + version="7.0.0", + collection_name="kubernetes.core", + ) + module.exit_json( # Some command might change environment, but ultimately failing at end changed=True, diff --git a/plugins/modules/k8s_service.py b/plugins/modules/k8s_service.py index b3cb7444..9c753939 100644 --- a/plugins/modules/k8s_service.py +++ b/plugins/modules/k8s_service.py @@ -36,6 +36,7 @@ options: - If more than one C(merge_type) is given, the merge_types will be tried in order - This defaults to C(['strategic-merge', 'merge']), which is ideal for using the same parameters on resource kinds that combine Custom Resources and built-in resources. + - I(merge_type=json) has been deprecated and will be removed in version 7.0.0. Use M(kubernetes.core.k8s_json_patch) instead. choices: - json - merge @@ -251,6 +252,15 @@ def main(): supports_check_mode=True, ) + # Add deprecation warning for merge_type=json + merge_type = module.params.get("merge_type") + if merge_type and "json" in merge_type: + module.deprecate( + "The 'merge_type=json' option is deprecated and will be removed in version 7.0.0. Use the 'kubernetes.core.k8s_json_patch' module instead.", + version="7.0.0", + collection_name="kubernetes.core", + ) + try: client = get_api_client(module=module) svc = K8sService(client, module) diff --git a/tests/sanity/ignore-2.16.txt b/tests/sanity/ignore-2.16.txt index d16fb3b6..4ff405e9 100644 --- a/tests/sanity/ignore-2.16.txt +++ b/tests/sanity/ignore-2.16.txt @@ -32,3 +32,6 @@ plugins/modules/k8s_service.py validate-modules:return-syntax-error plugins/modules/k8s_taint.py validate-modules:return-syntax-error tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml yamllint!skip tests/integration/targets/helm_diff/files/test-chart-deployment-time/templates/configmap.yaml yamllint!skip +plugins/modules/helm.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). +plugins/modules/k8s_exec.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). +plugins/modules/k8s_service.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). diff --git a/tests/sanity/ignore-2.17.txt b/tests/sanity/ignore-2.17.txt index d16fb3b6..64bf1e0c 100644 --- a/tests/sanity/ignore-2.17.txt +++ b/tests/sanity/ignore-2.17.txt @@ -32,3 +32,6 @@ plugins/modules/k8s_service.py validate-modules:return-syntax-error plugins/modules/k8s_taint.py validate-modules:return-syntax-error tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml yamllint!skip tests/integration/targets/helm_diff/files/test-chart-deployment-time/templates/configmap.yaml yamllint!skip +plugins/modules/helm.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). +plugins/modules/k8s_exec.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). +plugins/modules/k8s_service.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). diff --git a/tests/sanity/ignore-2.18.txt b/tests/sanity/ignore-2.18.txt index cdb5fc4d..f82d9ae5 100644 --- a/tests/sanity/ignore-2.18.txt +++ b/tests/sanity/ignore-2.18.txt @@ -35,3 +35,6 @@ plugins/modules/k8s_service.py validate-modules:return-syntax-error plugins/modules/k8s_taint.py validate-modules:return-syntax-error tests/integration/targets/helm_diff/files/test-chart-reuse-values/templates/configmap.yaml yamllint!skip tests/integration/targets/helm_diff/files/test-chart-deployment-time/templates/configmap.yaml yamllint!skip +plugins/modules/helm.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). +plugins/modules/k8s_exec.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239). +plugins/modules/k8s_service.py pylint:collection-deprecated-version # Remove after stable-7 branch is cut (See issue 1239).