1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fixes #29818: chkconfig command is not daemonized, uses run_command()

In the last commit I modified the code to run commands when they are
daemonized. But the execution of "chkconfig" is not daemonized so it
uses "self.module.run_command(cmd)".

This commit set the default localize to allow proper screen scraping of
chkconfig command.
This commit is contained in:
Adrian Lopez 2018-05-18 13:35:46 +02:00 committed by Brian Coca
parent 516e18f4b8
commit 7255b6a151

View file

@ -206,7 +206,10 @@ class Service(object):
# Most things don't need to be daemonized
if not daemonize:
return self.module.run_command(cmd)
# 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')
return self.module.run_command(cmd, environ_update=lang_env)
# This is complex because daemonization is hard for people.
# What we do is daemonize a part of this module, the daemon runs the