[PR #11779/d6909578 backport][stable-12] Ensure standard locale in run_command (group5-batch8) (#11804)

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.



* Add changelog fragment for PR #11779



---------


(cherry picked from commit d6909578b9)

Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com>
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
patchback[bot]
2026-04-12 22:28:52 +02:00
committed by GitHub
parent 582807ea3a
commit 150f63b36b
4 changed files with 13 additions and 0 deletions

View File

@@ -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).

View File

@@ -183,6 +183,7 @@ def main():
),
supports_check_mode=True,
)
module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"}
CapabilitiesModule(module)

View File

@@ -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:

View File

@@ -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.")