From 7255b6a15193ace30c18c1b55e91c5a1bb89e46a Mon Sep 17 00:00:00 2001 From: Adrian Lopez Date: Fri, 18 May 2018 13:35:46 +0200 Subject: [PATCH] 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. --- lib/ansible/modules/system/service.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/modules/system/service.py b/lib/ansible/modules/system/service.py index e6a719988b..d8d648034c 100644 --- a/lib/ansible/modules/system/service.py +++ b/lib/ansible/modules/system/service.py @@ -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