From 0691c9c099d56929321412df1f5842423a2dfdc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ivica=20Kolenka=C5=A1?= Date: Fri, 15 Jun 2018 14:25:54 +0200 Subject: [PATCH] setting LANG, LC_ALL and LC_NUMERIC to C (#41544) * This forces the fact gathering commands to use C locale, preventing weird locale issues such as different separator etc --- lib/ansible/module_utils/facts/hardware/linux.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/ansible/module_utils/facts/hardware/linux.py b/lib/ansible/module_utils/facts/hardware/linux.py index b6563cd4f2..3c0d5d4090 100644 --- a/lib/ansible/module_utils/facts/hardware/linux.py +++ b/lib/ansible/module_utils/facts/hardware/linux.py @@ -31,7 +31,7 @@ from ansible.module_utils.basic import bytes_to_human from ansible.module_utils.facts.hardware.base import Hardware, HardwareCollector from ansible.module_utils.facts.utils import get_file_content, get_file_lines, get_mount_size -# import this as a module to ensure we get the same module isntance +# import this as a module to ensure we get the same module instance from ansible.module_utils.facts import timeout @@ -78,6 +78,7 @@ class LinuxHardware(Hardware): def populate(self, collected_facts=None): hardware_facts = {} + self.module.run_command_environ_update = {'LANG': 'C', 'LC_ALL': 'C', 'LC_NUMERIC': 'C'} cpu_facts = self.get_cpu_facts(collected_facts=collected_facts) memory_facts = self.get_memory_facts()