From dfa9f77b7abdacdaecffe1ae6bbe3281aa29afd5 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Sun, 12 Apr 2026 22:27:16 +0200 Subject: [PATCH] [PR #11775/7c52f1c4 backport][stable-12] Ensure standard locale in run_command (group5-batch4) (#11808) Ensure standard locale in run_command (group5-batch4) (#11775) * Fix locale env vars in run_command() calls for group5 batch4 modules Set LANGUAGE=C and LC_ALL=C via run_command_environ_update to ensure locale-independent output parsing in logstash_plugin, lvg, mas, osx_defaults, and pkgutil. * Add changelog fragment for PR #11775 --------- (cherry picked from commit 7c52f1c41d0a9efc78cde95c0069419377ba428d) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- .../fragments/11775-group5-batch4-locale.yml | 16 ++++++++++++++++ plugins/modules/logstash_plugin.py | 1 + plugins/modules/lvg.py | 1 + plugins/modules/mas.py | 1 + plugins/modules/osx_defaults.py | 1 + plugins/modules/pkgutil.py | 1 + 6 files changed, 21 insertions(+) create mode 100644 changelogs/fragments/11775-group5-batch4-locale.yml diff --git a/changelogs/fragments/11775-group5-batch4-locale.yml b/changelogs/fragments/11775-group5-batch4-locale.yml new file mode 100644 index 0000000000..bd4bd3d7aa --- /dev/null +++ b/changelogs/fragments/11775-group5-batch4-locale.yml @@ -0,0 +1,16 @@ +bugfixes: + - logstash_plugin - 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/11775). + - lvg - 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/11775). + - mas - 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/11775). + - osx_defaults - 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/11775). + - pkgutil - 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/11775). diff --git a/plugins/modules/logstash_plugin.py b/plugins/modules/logstash_plugin.py index a4aca01f21..7c121aa21e 100644 --- a/plugins/modules/logstash_plugin.py +++ b/plugins/modules/logstash_plugin.py @@ -147,6 +147,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"] diff --git a/plugins/modules/lvg.py b/plugins/modules/lvg.py index 4b1fc434ab..93b84c3d1f 100644 --- a/plugins/modules/lvg.py +++ b/plugins/modules/lvg.py @@ -424,6 +424,7 @@ def main(): ], supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} vg = module.params["vg"] state = module.params["state"] diff --git a/plugins/modules/mas.py b/plugins/modules/mas.py index f6f28b6d4b..e9105dfe2e 100644 --- a/plugins/modules/mas.py +++ b/plugins/modules/mas.py @@ -265,6 +265,7 @@ def main(): ), supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} mas = Mas(module) if module.params["id"]: diff --git a/plugins/modules/osx_defaults.py b/plugins/modules/osx_defaults.py index b8f8c3c2bb..a65efbb86d 100644 --- a/plugins/modules/osx_defaults.py +++ b/plugins/modules/osx_defaults.py @@ -498,6 +498,7 @@ def main(): supports_check_mode=True, required_if=(("state", "present", ["value"]),), ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} try: defaults = OSXDefaults(module=module) diff --git a/plugins/modules/pkgutil.py b/plugins/modules/pkgutil.py index db74f3208f..256a78c5f3 100644 --- a/plugins/modules/pkgutil.py +++ b/plugins/modules/pkgutil.py @@ -205,6 +205,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"] site = module.params["site"]