From b4f09831b0010228ee551df235ea0b6449af76eb Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Wed, 8 Apr 2026 15:34:23 +0200 Subject: [PATCH] [PR #11740/936ab2ea backport][stable-12] Ensure standard locale in run_command (group3-batch2) (#11755) Ensure standard locale in run_command (group3-batch2) (#11740) * run_command locale group3 batch2: normalise to LANGUAGE=C, LC_ALL=C * fix changelog fragment: bugfixes, American English, separate code spans * fix changelog fragment: correct PR number (11740) * remove nmcli from batch2 - moved to dedicated branch --------- (cherry picked from commit 936ab2ea56c5694237d61784a9272e567222d744) Co-authored-by: Alexei Znamensky <103110+russoz@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.6 --- .../fragments/11740-run-command-locale-group3-batch2.yml | 9 +++++++++ plugins/modules/homebrew.py | 2 +- plugins/modules/homebrew_cask.py | 2 +- plugins/modules/icinga2_feature.py | 2 +- plugins/modules/iptables_state.py | 2 +- plugins/modules/java_keystore.py | 2 +- plugins/modules/lvol.py | 4 +--- plugins/modules/pacman.py | 2 +- plugins/modules/parted.py | 2 +- 9 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 changelogs/fragments/11740-run-command-locale-group3-batch2.yml diff --git a/changelogs/fragments/11740-run-command-locale-group3-batch2.yml b/changelogs/fragments/11740-run-command-locale-group3-batch2.yml new file mode 100644 index 0000000000..f4aa6b63ad --- /dev/null +++ b/changelogs/fragments/11740-run-command-locale-group3-batch2.yml @@ -0,0 +1,9 @@ +bugfixes: + - homebrew - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - homebrew_cask - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - icinga2_feature - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - iptables_state - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - java_keystore - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - lvol - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - pacman - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). + - parted - normalize locale environment for ``run_command()`` calls to ``LANGUAGE=C``, ``LC_ALL=C`` (https://github.com/ansible-collections/community.general/issues/11737, https://github.com/ansible-collections/community.general/pull/11740). diff --git a/plugins/modules/homebrew.py b/plugins/modules/homebrew.py index 740b00857b..f938e6f3a4 100644 --- a/plugins/modules/homebrew.py +++ b/plugins/modules/homebrew.py @@ -817,7 +817,7 @@ def main(): supports_check_mode=True, ) - module.run_command_environ_update = dict(LANG="C", LC_ALL="C", LC_MESSAGES="C", LC_CTYPE="C") + module.run_command_environ_update = dict(LANGUAGE="C", LC_ALL="C") p = module.params diff --git a/plugins/modules/homebrew_cask.py b/plugins/modules/homebrew_cask.py index 2da668b737..7729c8c1bd 100644 --- a/plugins/modules/homebrew_cask.py +++ b/plugins/modules/homebrew_cask.py @@ -779,7 +779,7 @@ def main(): supports_check_mode=True, ) - module.run_command_environ_update = dict(LANG="C", LC_ALL="C", LC_MESSAGES="C", LC_CTYPE="C") + module.run_command_environ_update = dict(LANGUAGE="C", LC_ALL="C") p = module.params diff --git a/plugins/modules/icinga2_feature.py b/plugins/modules/icinga2_feature.py index 87a57935bd..7901a283e2 100644 --- a/plugins/modules/icinga2_feature.py +++ b/plugins/modules/icinga2_feature.py @@ -124,7 +124,7 @@ def main(): supports_check_mode=True, ) - module.run_command_environ_update = dict(LANG="C", LC_ALL="C", LC_MESSAGES="C", LC_CTYPE="C") + module.run_command_environ_update = dict(LANGUAGE="C", LC_ALL="C") Icinga2FeatureHelper(module).manage() diff --git a/plugins/modules/iptables_state.py b/plugins/modules/iptables_state.py index 9bb66a0597..5a4136b53d 100644 --- a/plugins/modules/iptables_state.py +++ b/plugins/modules/iptables_state.py @@ -375,7 +375,7 @@ def main() -> None: ) # We'll parse iptables-restore stderr - module.run_command_environ_update = dict(LANG="C", LC_MESSAGES="C") + module.run_command_environ_update = dict(LANGUAGE="C", LC_ALL="C") path = module.params["path"] state = module.params["state"] diff --git a/plugins/modules/java_keystore.py b/plugins/modules/java_keystore.py index 99e452365f..546c2f802e 100644 --- a/plugins/modules/java_keystore.py +++ b/plugins/modules/java_keystore.py @@ -531,7 +531,7 @@ def create_module() -> AnsibleModule: supports_check_mode=True, add_file_common_args=True, ) - module.run_command_environ_update = dict(LANG="C", LC_ALL="C", LC_MESSAGES="C") + module.run_command_environ_update = dict(LANGUAGE="C", LC_ALL="C") return module diff --git a/plugins/modules/lvol.py b/plugins/modules/lvol.py index f8f035875b..5bbfb7ea75 100644 --- a/plugins/modules/lvol.py +++ b/plugins/modules/lvol.py @@ -239,10 +239,8 @@ from ansible.module_utils.basic import AnsibleModule LVOL_ENV_VARS = dict( # make sure we use the C locale when running lvol-related commands - LANG="C", + LANGUAGE="C", LC_ALL="C", - LC_MESSAGES="C", - LC_CTYPE="C", ) diff --git a/plugins/modules/pacman.py b/plugins/modules/pacman.py index 6dd7a982b1..c7152e3b23 100644 --- a/plugins/modules/pacman.py +++ b/plugins/modules/pacman.py @@ -303,7 +303,7 @@ class Pacman: def __init__(self, module): self.m = module - self.m.run_command_environ_update = dict(LC_ALL="C") + self.m.run_command_environ_update = dict(LANGUAGE="C", LC_ALL="C") p = self.m.params self._msgs = [] diff --git a/plugins/modules/parted.py b/plugins/modules/parted.py index bd5e076488..e34141ee65 100644 --- a/plugins/modules/parted.py +++ b/plugins/modules/parted.py @@ -629,7 +629,7 @@ def main(): ], supports_check_mode=True, ) - module.run_command_environ_update = {"LANG": "C", "LC_ALL": "C", "LC_MESSAGES": "C", "LC_CTYPE": "C"} + module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"} # Data extraction device = module.params["device"]