Skip to content

Remove remaining ansible.module_utils.six import from kubectl connection plugin - #1197

Merged
abikouo merged 2 commits into
ansible-collections:mainfrom
ChihweiLHBird:six-to-stdlib
Jul 31, 2026
Merged

Remove remaining ansible.module_utils.six import from kubectl connection plugin#1197
abikouo merged 2 commits into
ansible-collections:mainfrom
ChihweiLHBird:six-to-stdlib

Conversation

@ChihweiLHBird

@ChihweiLHBird ChihweiLHBird commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
SUMMARY

#998 removed the ansible.module_utils.six imports, but plugins/connection/kubectl.py was missed and still imports the shim. This replaces it with the stdlib equivalent:

-from ansible.module_utils.six.moves import shlex_quote
+from shlex import quote as shlex_quote

On Python 3 six.moves.shlex_quote is already shlex.quote (the same function object), so there is no behaviour change at the single call site in put_file(). The import is placed in the stdlib group to keep tox -e linters clean.

ansible.module_utils.six is deprecated in ansible-core 2.21 and scheduled for removal in 2.24.

ISSUE TYPE
  • Refactoring Pull Request
COMPONENT NAME

plugins/connection/kubectl.py

@centosinfra-prod-github-app

Copy link
Copy Markdown

@centosinfra-prod-github-app

Copy link
Copy Markdown

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.
@centosinfra-prod-github-app

Copy link
Copy Markdown

@abikouo abikouo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Just a minor remark regarding the PR link in the changelog fragment

Comment thread changelogs/fragments/20260723-remove-module-utils-six.yaml Outdated
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
@ChihweiLHBird
ChihweiLHBird requested a review from abikouo July 28, 2026 16:23
@sonarqubecloud

Copy link
Copy Markdown

@centosinfra-prod-github-app

Copy link
Copy Markdown

@abikouo
abikouo merged commit dd4ca7a into ansible-collections:main Jul 31, 2026
47 of 48 checks passed
@patchback

patchback Bot commented Jul 31, 2026

Copy link
Copy Markdown

Backport to stable-5: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-5/dd4ca7a8b05deb196e790426426147c43175170c/pr-1197

Backported as #1199

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@patchback

patchback Bot commented Jul 31, 2026

Copy link
Copy Markdown

Backport to stable-6: 💚 backport PR created

✅ Backport PR branch: patchback/backports/stable-6/dd4ca7a8b05deb196e790426426147c43175170c/pr-1197

Backported as #1200

🤖 @patchback
I'm built with octomachinery and
my source is open — https://github.com/sanitizers/patchback-github-app.

@ChihweiLHBird
ChihweiLHBird deleted the six-to-stdlib branch July 31, 2026 15:57
abikouo added a commit that referenced this pull request Aug 11, 2026
…ction plugin (#1197) (#1200)

* 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 dd4ca7a)

Co-authored-by: Zhiwei Liang <zhiwei.liang@zliang.me>
Co-authored-by: Bikouo Aubin <79859644+abikouo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants