Module: check_mk
Branch: master
Commit: 9fd4e84df63c5447b2b04ca686ac515766fb5fdb
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9fd4e84df63c54…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Nov 30 17:44:11 2010 +0100
Final fix for omd apache shared mode
---
web/htdocs/wato.py | 14 ++++++--------
1 files changed, 6 insertions(+), 8 deletions(-)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 4c0d68c..68a5b8b 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -489,18 +489,18 @@ def check_mk_automation(command, args=[], indata=""):
# - When not set try to detect the command for OMD or non OMD installations
# - OMD 'own' apache mode or non OMD: check_mk --automation
# - OMD 'shared' apache mode: Full path to the binary and the defaults
- commandargs = []
if defaults.check_mk_automation:
commandargs = defaults.check_mk_automation.split()
+ cmd = commandargs + [ command ] + args
else:
apache_user, omd_mode, omd_site = html.omd_mode()
if not omd_mode or omd_mode == 'own':
commandargs = [ 'check_mk', '--automation' ]
+ cmd = commandargs + [ command ] + args
else:
- commandargs = [ 'sudo', '-u', omd_site,
'/usr/bin/env', 'python',
-
'/omd/sites/'+omd_site+'/share/check_mk/modules/check_mk.py',
- '--defaults',
'/omd/sites/'+omd_site+'/etc/check_mk/defaults',
- '--automation' ]
+ commandargs = [ 'sudo', '/bin/su', '-', omd_site,
'-c', 'check_mk --automation' ]
+ cmd = commandargs
+ cmd[-1] += ' ' + ' '.join([ command ] + args)
if commandargs[0] == 'sudo':
sudo_msg = ("<p>The webserver is running as user which has no rights
on the "
@@ -513,9 +513,7 @@ def check_mk_automation(command, args=[], indata=""):
"%s ALL = (%s) NOPASSWD: %s *\n"
"</pre></li>\n"
"<li>Retry this operation</li></ol>\n" %
- (apache_user, apache_user, omd_site, "
".join(commandargs[3:])))
-
- cmd = commandargs + [ command ] + args
+ (apache_user, apache_user, omd_site, "
".join(commandargs[1:])))
try:
p = subprocess.Popen(cmd,
stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)