Modify the way we set the localization environment

Previously, we set the LANG (and LC_CTYPE) environment variables
directly in the module code and applied them with os.environ().
Instead, we are now pre-pending those variables to the environment
string used to execute the command which allows the user to
override the localization values by setting the environment values
directly (even on a per-task basis):

  - subversion: repo=file:///path/to/repos/svn_über dest=/tmp/svntest
    environment:
      LANG: "C"
      LC_CTYPE: "en_US.UTF-8"

So if a user wishes to default their LANG back to C, they can still
avoid unicode issues by doing the above.

Fixes #7060
This commit is contained in:
James Cammarata 2014-05-01 10:34:53 -05:00
parent 40a7a306f5
commit 54b1f820fb
3 changed files with 14 additions and 15 deletions

View file

@ -30,7 +30,6 @@
# == BEGIN DYNAMICALLY INSERTED CODE ==
MODULE_ARGS = "<<INCLUDE_ANSIBLE_MODULE_ARGS>>"
MODULE_LANG = "<<INCLUDE_ANSIBLE_MODULE_LANG>>"
MODULE_COMPLEX_ARGS = "<<INCLUDE_ANSIBLE_MODULE_COMPLEX_ARGS>>"
BOOLEANS_TRUE = ['yes', 'on', '1', 'true', 1]
@ -191,8 +190,6 @@ class AnsibleModule(object):
if k not in self.argument_spec:
self.argument_spec[k] = v
os.environ['LANG'] = MODULE_LANG
os.environ['LC_CTYPE'] = MODULE_LANG
(self.params, self.args) = self._load_params()
self._legal_inputs = ['CHECKMODE', 'NO_LOG']