From d6909578b986508d2790644dae334c93cbf2200b Mon Sep 17 00:00:00 2001 From: Alexei Znamensky <103110+russoz@users.noreply.github.com> Date: Mon, 13 Apr 2026 07:59:38 +1200 Subject: [PATCH] Ensure standard locale in run_command (group5-batch8) (#11779) * Fix locale env vars in run_command() calls for group5 batch8 modules Set LANGUAGE=C and LC_ALL=C via run_command_environ_update to ensure locale-independent output parsing in lxc_container, ip_netns, and capabilities. Co-Authored-By: Claude Sonnet 4.6 * Add changelog fragment for PR #11779 Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Claude Sonnet 4.6 --- changelogs/fragments/11779-group5-batch8-locale.yml | 10 ++++++++++ plugins/modules/capabilities.py | 1 + plugins/modules/ip_netns.py | 1 + plugins/modules/lxc_container.py | 1 + 4 files changed, 13 insertions(+) create mode 100644 changelogs/fragments/11779-group5-batch8-locale.yml diff --git a/changelogs/fragments/11779-group5-batch8-locale.yml b/changelogs/fragments/11779-group5-batch8-locale.yml new file mode 100644 index 0000000000..6a235c1e3b --- /dev/null +++ b/changelogs/fragments/11779-group5-batch8-locale.yml @@ -0,0 +1,10 @@ +bugfixes: + - capabilities - 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/11779). + - ip_netns - 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/11779). + - lxc_container - 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/11779). diff --git a/plugins/modules/capabilities.py b/plugins/modules/capabilities.py index 5b5a11f1e9..035c0a938a 100644 --- a/plugins/modules/capabilities.py +++ b/plugins/modules/capabilities.py @@ -183,6 +183,7 @@ def main(): ), supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} CapabilitiesModule(module) diff --git a/plugins/modules/ip_netns.py b/plugins/modules/ip_netns.py index 29d05f87cc..ee10bcb092 100644 --- a/plugins/modules/ip_netns.py +++ b/plugins/modules/ip_netns.py @@ -122,6 +122,7 @@ def main(): }, supports_check_mode=True, ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} network_namespace = Namespace(module) if module.check_mode: diff --git a/plugins/modules/lxc_container.py b/plugins/modules/lxc_container.py index fc43ef1536..facce31f6f 100644 --- a/plugins/modules/lxc_container.py +++ b/plugins/modules/lxc_container.py @@ -1432,6 +1432,7 @@ def main(): supports_check_mode=False, required_if=([("archive", True, ["archive_path"])]), ) + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} if not HAS_LXC: module.fail_json(msg="The `lxc` module is not importable. Check the requirements.")