Move module_set_locale and module_lang back to global

These config settings are being deprecated so we don't want people to
think they need to implement them for their new shell plugin.
This commit is contained in:
Toshio Kuratomi 2018-01-22 16:16:11 -08:00
parent 62bc714dae
commit b151f5d942
4 changed files with 35 additions and 36 deletions

View file

@ -23,6 +23,7 @@ import random
import re
import time
import ansible.constants as C
from ansible.module_utils.six import text_type
from ansible.module_utils.six.moves import shlex_quote
from ansible.plugins import AnsiblePlugin
@ -36,22 +37,18 @@ class ShellBase(AnsiblePlugin):
super(ShellBase, self).__init__()
self.env = {}
if C.DEFAULT_MODULE_SET_LOCALE:
module_locale = C.DEFAULT_MODULE_LANG
self.env = {'LANG': module_locale,
'LC_ALL': module_locale,
'LC_MESSAGES': module_locale}
self.tempdir = None
def set_options(self, task_keys=None, var_options=None, direct=None):
super(ShellBase, self).set_options(task_keys=task_keys, var_options=var_options, direct=direct)
# not all shell modules have this option
if self.get_option('set_module_language'):
self.env.update(
dict(
LANG=self.get_option('module_language'),
LC_ALL=self.get_option('module_language'),
LC_MESSAGES=self.get_option('module_language'),
)
)
# set env
self.env.update(self.get_option('environment'))