Module: check_mk
Branch: master
Commit: 0346c8ca6e18e41d24dbfea2f3116f9731f90356
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0346c8ca6e18e4…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 17 13:55:09 2016 +0100
Removed handling of deprecated OMD apache shared mode
---
web/htdocs/html_mod_python.py | 14 --------------
web/htdocs/watolib.py | 27 +++++++++------------------
2 files changed, 9 insertions(+), 32 deletions(-)
diff --git a/web/htdocs/html_mod_python.py b/web/htdocs/html_mod_python.py
index 6ff3577..8777e2b 100644
--- a/web/htdocs/html_mod_python.py
+++ b/web/htdocs/html_mod_python.py
@@ -227,20 +227,6 @@ class html_mod_python(htmllib.html):
self.javascript('update_header_timer()')
self.top_heading_right()
- def omd_mode(self):
- # Load mod_python env into regular environment
- for k, v in self.req.subprocess_env.items():
- os.environ[k] = v
-
- omd_mode = None
- omd_site = None
- if 'OMD_SITE' in os.environ:
- omd_site = os.environ['OMD_SITE']
- omd_mode = 'shared'
- if omd_site == self.apache_user():
- omd_mode = 'own'
- return (omd_mode, omd_site)
-
def log(self, *args):
from lib import logger, LOG_NOTICE
for arg in args:
diff --git a/web/htdocs/watolib.py b/web/htdocs/watolib.py
index 85aa7b5..3821d50 100644
--- a/web/htdocs/watolib.py
+++ b/web/htdocs/watolib.py
@@ -3885,30 +3885,21 @@ def check_mk_local_automation(command, args=[],
indata="", stdin_data=None, time
# Gather the command to use for executing --automation calls to check_mk
# - First try to use the check_mk_automation option from the defaults
- # - 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
- sudoline = None
+ # - When not set use "check_mk --automation"
if defaults.check_mk_automation:
commandargs = defaults.check_mk_automation.split()
- cmd = commandargs + [ command, '--' ] + args
else:
- omd_mode, omd_site = html.omd_mode()
- if not omd_mode or omd_mode == 'own':
- commandargs = [ 'check_mk', '--automation' ]
- cmd = commandargs + [ command, '--' ] + args
- else: # OMD shared mode
- commandargs = [ 'sudo', '/bin/su', '-', omd_site,
'-c', 'check_mk --automation' ]
- cmd = commandargs[:-1] + [ commandargs[-1] + ' ' + ' '.join([
command, '--' ] + args) ]
- sudoline = "%s ALL = (root) NOPASSWD: /bin/su - %s -c check_mk\\
--automation\\ *" % (html.apache_user(), omd_site)
+ commandargs = [ 'check_mk', '--automation' ]
+ cmd = commandargs + [ command, '--' ] + args
sudo_msg = ''
if commandargs[0] == 'sudo':
- if not sudoline:
- if commandargs[1] == '-u': # skip -u USER in /etc/sudoers
- sudoline = "%s ALL = (%s) NOPASSWD: %s *" %
(html.apache_user(), commandargs[2], " ".join(commandargs[3:]))
- else:
- sudoline = "%s ALL = (root) NOPASSWD: %s *" %
(html.apache_user(), commandargs[0], " ".join(commandargs[1:]))
+ if commandargs[1] == '-u': # skip -u USER in /etc/sudoers
+ sudoline = "%s ALL = (%s) NOPASSWD: %s *" % \
+ (html.apache_user(), commandargs[2], "
".join(commandargs[3:]))
+ else:
+ sudoline = "%s ALL = (root) NOPASSWD: %s *" % \
+ (html.apache_user(), " ".join(commandargs[1:]))
sudo_msg = ("<p>The webserver is running as user which has no rights
on the "
"needed Check_MK/Nagios files.<br>Please ensure you have
set-up "