From 582807ea3ab9ee48fa079544445a231bccbbdb4c Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 12 Apr 2026 22:28:44 +0200 Subject: [PATCH] [PR #11780/5c6a5999 backport][stable-12] Ensure standard locale in run_command (group5-batch9) (#11803) Ensure standard locale in run_command (group5-batch9) (#11780) * Fix locale env vars in run_command() calls for group5 batch9 modules Set LANGUAGE=C and LC_ALL=C via run_command_environ_update to ensure locale-independent output parsing in beadm, pkg5, pkg5_publisher, and swdepot. * Add changelog fragment for PR #11780 --------- (cherry picked from commit 5c6a5999406b41c3f28f2f141c910ad8d30051c7) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- changelogs/fragments/11780-group5-batch9-locale.yml | 13 +++++++++++++ plugins/modules/beadm.py | 1 + plugins/modules/pkg5.py | 1 + plugins/modules/pkg5_publisher.py | 1 + plugins/modules/swdepot.py | 1 + 5 files changed, 17 insertions(+) create mode 100644 changelogs/fragments/11780-group5-batch9-locale.yml diff --git a/changelogs/fragments/11780-group5-batch9-locale.yml b/changelogs/fragments/11780-group5-batch9-locale.yml new file mode 100644 index 0000000000..8fbf7b9f9c --- /dev/null +++ b/changelogs/fragments/11780-group5-batch9-locale.yml @@ -0,0 +1,13 @@ +bugfixes: + - beadm - set ``LANGUAGE`` and ``LC_ALL`` to ``C`` in ``run_command()`` calls to ensure locale-independent output parsing + (https://github.com/ansible-collections/community.general/issues/11737, + https://github.com/ansible-collections/community.general/pull/11780). + - pkg5 - set ``LANGUAGE`` and ``LC_ALL`` to ``C`` in ``run_command()`` calls to ensure locale-independent output parsing + (https://github.com/ansible-collections/community.general/issues/11737, + https://github.com/ansible-collections/community.general/pull/11780). + - pkg5_publisher - set ``LANGUAGE`` and ``LC_ALL`` to ``C`` in ``run_command()`` calls to ensure locale-independent output parsing + (https://github.com/ansible-collections/community.general/issues/11737, + https://github.com/ansible-collections/community.general/pull/11780). + - swdepot - set ``LANGUAGE`` and ``LC_ALL`` to ``C`` in ``run_command()`` calls to ensure locale-independent output parsing + (https://github.com/ansible-collections/community.general/issues/11737, + https://github.com/ansible-collections/community.general/pull/11780). diff --git a/plugins/modules/beadm.py b/plugins/modules/beadm.py index ff65313208..be9d0971d6 100644 --- a/plugins/modules/beadm.py +++ b/plugins/modules/beadm.py @@ -288,6 +288,7 @@ def main(): ), supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} be = BE(module) diff --git a/plugins/modules/pkg5.py b/plugins/modules/pkg5.py index 1138d39722..f6e81ba700 100644 --- a/plugins/modules/pkg5.py +++ b/plugins/modules/pkg5.py @@ -101,6 +101,7 @@ def main(): ), supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} params = module.params packages = [] diff --git a/plugins/modules/pkg5_publisher.py b/plugins/modules/pkg5_publisher.py index 1c73f25ffa..910b218b3e 100644 --- a/plugins/modules/pkg5_publisher.py +++ b/plugins/modules/pkg5_publisher.py @@ -84,6 +84,7 @@ def main(): mirror=dict(type="list", elements="str"), ) ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} for option in ["origin", "mirror"]: if module.params[option] == [""]: diff --git a/plugins/modules/swdepot.py b/plugins/modules/swdepot.py index 5df924fc99..c2d9f29d7a 100644 --- a/plugins/modules/swdepot.py +++ b/plugins/modules/swdepot.py @@ -136,6 +136,7 @@ def main(): ), supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} name = module.params["name"] state = module.params["state"] depot = module.params["depot"]