From 260a3e5ce793f80edad22c3af03b44cb23c7d423 Mon Sep 17 00:00:00 2001 From: Mathieu Date: Mon, 19 Oct 2015 21:25:30 +0200 Subject: [PATCH] Fixes #11055 - Set locale via LC_ALL --- lib/ansible/module_utils/basic.py | 4 ++-- lib/ansible/runner/shell_plugins/sh.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/module_utils/basic.py b/lib/ansible/module_utils/basic.py index 17e2773e5b6..5827cf43b71 100644 --- a/lib/ansible/module_utils/basic.py +++ b/lib/ansible/module_utils/basic.py @@ -735,8 +735,8 @@ class AnsibleModule(object): # issues but is preferable to simply failing because # of an unknown locale locale.setlocale(locale.LC_ALL, 'C') - os.environ['LANG'] = 'C' - os.environ['LC_CTYPE'] = 'C' + os.environ['LANG'] = 'C' + os.environ['LC_ALL'] = 'C' except Exception, e: self.fail_json(msg="An unknown error was encountered while attempting to validate the locale: %s" % e) diff --git a/lib/ansible/runner/shell_plugins/sh.py b/lib/ansible/runner/shell_plugins/sh.py index 1ee225830b5..730f6d2a92e 100644 --- a/lib/ansible/runner/shell_plugins/sh.py +++ b/lib/ansible/runner/shell_plugins/sh.py @@ -24,8 +24,8 @@ class ShellModule(object): def env_prefix(self, **kwargs): '''Build command prefix with environment variables.''' env = dict( - LANG = C.DEFAULT_MODULE_LANG, - LC_CTYPE = C.DEFAULT_MODULE_LANG, + LANG = C.DEFAULT_MODULE_LANG, + LC_ALL = C.DEFAULT_MODULE_LANG, ) env.update(kwargs) return ' '.join(['%s=%s' % (k, pipes.quote(unicode(v))) for k,v in env.items()])