mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
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:
parent
62bc714dae
commit
b151f5d942
4 changed files with 35 additions and 36 deletions
|
@ -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'))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue