mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Ensure standard locale in run_command (group5-batch14) (#11785)
* Fix locale env vars in run_command() calls for group5 batch14 modules Set LANGUAGE=C and LC_ALL=C via run_command_environ_update to ensure locale-independent output parsing in bzr, lldp, and ohai. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add changelog fragment for PR #11785 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:
10
changelogs/fragments/11785-group5-batch14-locale.yml
Normal file
10
changelogs/fragments/11785-group5-batch14-locale.yml
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
bugfixes:
|
||||||
|
- bzr - 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/11785).
|
||||||
|
- lldp - 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/11785).
|
||||||
|
- ohai - 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/11785).
|
||||||
@@ -147,6 +147,7 @@ def main():
|
|||||||
executable=dict(type="str"),
|
executable=dict(type="str"),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"}
|
||||||
|
|
||||||
dest = module.params["dest"]
|
dest = module.params["dest"]
|
||||||
parent = module.params["name"]
|
parent = module.params["name"]
|
||||||
|
|||||||
@@ -95,6 +95,7 @@ def gather_lldp(module):
|
|||||||
def main():
|
def main():
|
||||||
module_args = dict(multivalues=dict(type="bool", default=False))
|
module_args = dict(multivalues=dict(type="bool", default=False))
|
||||||
module = AnsibleModule(module_args)
|
module = AnsibleModule(module_args)
|
||||||
|
module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"}
|
||||||
|
|
||||||
lldp_output = gather_lldp(module)
|
lldp_output = gather_lldp(module)
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ from ansible.module_utils.basic import AnsibleModule
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
module = AnsibleModule(argument_spec=dict())
|
module = AnsibleModule(argument_spec=dict())
|
||||||
|
module.run_command_environ_update = {"LANGUAGE": "C", "LC_ALL": "C"}
|
||||||
cmd = ["/usr/bin/env", "ohai"]
|
cmd = ["/usr/bin/env", "ohai"]
|
||||||
rc, out, err = module.run_command(cmd, check_rc=True)
|
rc, out, err = module.run_command(cmd, check_rc=True)
|
||||||
module.exit_json(**json.loads(out))
|
module.exit_json(**json.loads(out))
|
||||||
|
|||||||
Reference in New Issue
Block a user