Module: check_mk
Branch: master
Commit: 3bf576dbc44dec362485be81c0ac355a3bc42b0b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3bf576dbc44dec…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Sat May 19 18:59:01 2018 +0200
CRE: Precompiled host check print error when executed with wrong python
Change-Id: Id27e2159aa7b39fe1dc3047710f8704ad71d103a
---
cmk_base/core_nagios.py | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/cmk_base/core_nagios.py b/cmk_base/core_nagios.py
index f5e9f0c..68719bf 100644
--- a/cmk_base/core_nagios.py
+++ b/cmk_base/core_nagios.py
@@ -966,7 +966,11 @@ def _precompile_hostcheck(hostname):
output.write("#!/usr/bin/env python\n")
output.write("# encoding: utf-8\n\n")
- output.write("import sys\n")
+ output.write("import sys\n\n")
+
+ output.write("if not sys.executable.startswith('/omd'):\n")
+ output.write(" sys.stdout.write(\"ERROR: Only executable with sites
python\\n\")\n")
+ output.write(" sys.exit(2)\n\n")
# Remove precompiled directory from sys.path. Leaving it in the path
# makes problems when host names (name of precompiled files) are equal