mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 13:52:54 +00:00
chkconfig localizes messages, ansible fails to recognise
In the particular case of executin "chkconfig --list NAME", ansible checks the stderr looking for a particular english message. This message is different in other languages, Spanish for example (although it have been corrected in the latests versions) Fixes #29818
This commit is contained in:
@@ -248,7 +248,10 @@ class Service(object):
|
|||||||
cmd = [to_bytes(c, errors='surrogate_or_strict') for c in shlex.split(cmd)]
|
cmd = [to_bytes(c, errors='surrogate_or_strict') for c in shlex.split(cmd)]
|
||||||
# In either of the above cases, pass a list of byte strings to Popen
|
# In either of the above cases, pass a list of byte strings to Popen
|
||||||
|
|
||||||
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, preexec_fn=lambda: os.close(pipe[1]))
|
# chkconfig localizes messages and we're screen scraping so make
|
||||||
|
# sure we use the C locale
|
||||||
|
lang_env = dict(LANG='C', LC_ALL='C', LC_MESSAGES='C')
|
||||||
|
p = subprocess.Popen(cmd, shell=False, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=lang_env, preexec_fn=lambda: os.close(pipe[1]))
|
||||||
stdout = b("")
|
stdout = b("")
|
||||||
stderr = b("")
|
stderr = b("")
|
||||||
fds = [p.stdout, p.stderr]
|
fds = [p.stdout, p.stderr]
|
||||||
|
|||||||
Reference in New Issue
Block a user