From c35fc5e10ebba512c84c2ee66b4779c1de525874 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Mon, 14 Sep 2026 15:09:04 +0100 Subject: [PATCH] Remove remaining `ansible.module_utils.six` import from kubectl connection plugin (#1197) (#1199) * Replace ansible.module_utils.six with Python stdlib equivalents ansible.module_utils.six is deprecated in ansible-core 2.21 and is scheduled for removal in 2.24. Every use of it in this collection has a direct Python 3 standard library equivalent, so switch to those. * Update changelogs/fragments/20260723-remove-module-utils-six.yaml --------- (cherry picked from commit dd4ca7a8b05deb196e790426426147c43175170c) Co-authored-by: Zhiwei Liang Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com> --- changelogs/fragments/20260723-remove-module-utils-six.yaml | 4 ++++ plugins/connection/kubectl.py | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/20260723-remove-module-utils-six.yaml diff --git a/changelogs/fragments/20260723-remove-module-utils-six.yaml b/changelogs/fragments/20260723-remove-module-utils-six.yaml new file mode 100644 index 00000000..bdbe2187 --- /dev/null +++ b/changelogs/fragments/20260723-remove-module-utils-six.yaml @@ -0,0 +1,4 @@ +--- +minor_changes: + - Remove the remaining ``ansible.module_utils.six`` import to avoid deprecation + warnings, replacing it with the Python standard library equivalent (https://github.com/ansible-collections/kubernetes.core/pull/1197). diff --git a/plugins/connection/kubectl.py b/plugins/connection/kubectl.py index 03e2b7e0..38ebf2f6 100644 --- a/plugins/connection/kubectl.py +++ b/plugins/connection/kubectl.py @@ -265,11 +265,11 @@ import os.path import shutil import subprocess import tempfile +from shlex import quote as shlex_quote from ansible.errors import AnsibleError, AnsibleFileNotFound from ansible.module_utils._text import to_bytes from ansible.module_utils.parsing.convert_bool import boolean -from ansible.module_utils.six.moves import shlex_quote from ansible.parsing.yaml.loader import AnsibleLoader from ansible.plugins.connection import BUFSIZE, ConnectionBase from ansible.utils.display import Display