Ensure standard locale in run_command (group3-batch3) (#11741)

* run_command locale group3 batch3: normalise to LANGUAGE=C, LC_ALL=C

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix changelog fragment: bugfixes, American English, separate code spans

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix changelog fragment: correct PR number (11741)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Alexei Znamensky
2026-04-09 01:21:58 +12:00
committed by GitHub
parent 936ab2ea56
commit e59888dd7e
10 changed files with 22 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
bugfixes:
- pkgin - 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/11741).
- redhat_subscription - 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/11741).
- rhsm_repository - 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/11741).
- runit - 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/11741).
- supervisorctl - 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/11741).
- svc - 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/11741).
- ufw - 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/11741).
- zypper - 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/11741).

View File

@@ -353,7 +353,7 @@ def main():
global PKGIN_PATH
PKGIN_PATH = module.get_bin_path("pkgin", True, ["/opt/local/bin"])
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

View File

@@ -931,7 +931,7 @@ class RhsmPools:
args += " --consumed"
else:
args += " --available"
lang_env = dict(LANG="C", LC_ALL="C", LC_MESSAGES="C")
lang_env = dict(LANGUAGE="C", LC_ALL="C")
rc, stdout, stderr = self.module.run_command(args, check_rc=True, environ_update=lang_env)
products = []

View File

@@ -93,7 +93,7 @@ class Rhsm:
self.module = module
self.rhsm_bin = self.module.get_bin_path("subscription-manager", required=True)
self.rhsm_kwargs = {
"environ_update": dict(LANG="C", LC_ALL="C", LC_MESSAGES="C"),
"environ_update": dict(LANGUAGE="C", LC_ALL="C"),
"expand_user_and_vars": False,
"use_unsafe_shell": False,
}

View File

@@ -225,7 +225,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")
state = module.params["state"]
enabled = module.params["enabled"]

View File

@@ -153,7 +153,7 @@ def main():
signal = module.params.get("signal")
# we check error message for a pattern, so we need to make sure that's in C locale
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")
if supervisorctl_path:
if os.path.exists(supervisorctl_path) and is_executable(supervisorctl_path):

View File

@@ -255,7 +255,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")
state = module.params["state"]
enabled = module.params["enabled"]

View File

@@ -395,7 +395,7 @@ def main():
cmd = " ".join(map(itemgetter(-1), filter(itemgetter(0), cmd)))
cmds.append(cmd)
(rc, out, err) = module.run_command(cmd, environ_update={"LANG": "C"})
(rc, out, err) = module.run_command(cmd, environ_update={"LANGUAGE": "C", "LC_ALL": "C"})
if rc != 0 and not ignore_error:
module.fail_json(msg=err or out, commands=cmds)

View File

@@ -624,7 +624,7 @@ def main():
supports_check_mode=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")
name = module.params["name"]
state = module.params["state"]

View File

@@ -449,7 +449,7 @@ TEST_CASES = [
(
[
"subscription-manager list --available",
{"check_rc": True, "environ_update": {"LANG": "C", "LC_ALL": "C", "LC_MESSAGES": "C"}},
{"check_rc": True, "environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}},
(
0,
"""
@@ -559,7 +559,7 @@ Entitlement Type: Physical
(
[
"subscription-manager list --available",
{"check_rc": True, "environ_update": {"LANG": "C", "LC_ALL": "C", "LC_MESSAGES": "C"}},
{"check_rc": True, "environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}},
(
0,
"""
@@ -655,7 +655,7 @@ Entitlement Type: Physical
(
[
"subscription-manager list --available",
{"check_rc": True, "environ_update": {"LANG": "C", "LC_ALL": "C", "LC_MESSAGES": "C"}},
{"check_rc": True, "environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}},
(
0,
"""
@@ -733,7 +733,7 @@ Entitlement Type: Physical
),
(
"subscription-manager list --consumed",
{"check_rc": True, "environ_update": {"LANG": "C", "LC_ALL": "C", "LC_MESSAGES": "C"}},
{"check_rc": True, "environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}},
(
0,
"""
@@ -776,7 +776,7 @@ Entitlement Type: Physical
(
[
"subscription-manager list --available",
{"check_rc": True, "environ_update": {"LANG": "C", "LC_ALL": "C", "LC_MESSAGES": "C"}},
{"check_rc": True, "environ_update": {"LANGUAGE": "C", "LC_ALL": "C"}},
(
0,
"""