Module: check_mk
Branch: master
Commit: 1815b011625a1856efdf3748eb09a63d5aeccc1b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1815b011625a18…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Wed Apr 10 11:05:19 2019 +0200
agent_vsphere: factor out legacy pysphere call
Change-Id: I549e4c5d738227a897a6526ef5eb30daf7c73d07
---
agents/special/agent_vsphere | 21 ++++++++++-----------
1 file changed, 10 insertions(+), 11 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 1cb3d7b..46d04c3 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -1726,6 +1726,15 @@ def fetch_data(connection):
section_systemtime(connection)
+def call_legacy_pysphere():
+ # TODO: Remove this, drop agent_vsphere.pysphere
+ import subprocess
+
+ path_vsphere_pysphere = os.path.dirname(os.path.abspath(__file__))
+ cmd = ["%s/agent_vsphere.pysphere" % path_vsphere_pysphere] + sys.argv[1:]
+ return subprocess.call(cmd)
+
+
# .--Main----------------------------------------------------------------.
# | __ __ _ |
# | | \/ | __ _(_)_ __ |
@@ -1817,18 +1826,8 @@ for o, a in opts:
error_exit = 0 if opt_agent else 1
# If the --pysphere option is set we use the legacy pysphere agent, though 50 times
slower...
-# TODO: Remove this, drop agent_vsphere.pysphere
if opt_pysphere:
- path_vsphere_pysphere = os.path.dirname(os.path.abspath(__file__))
- cmd = ["%s/agent_vsphere.pysphere" % path_vsphere_pysphere]
- import subprocess
- proc = subprocess.Popen(cmd + sys.argv[1:], stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
- out, err = proc.communicate()
- if out:
- sys.stdout.write(out)
- if err:
- sys.stderr.write(err)
- sys.exit(proc.returncode)
+ sys.exit(call_legacy_pysphere())
if len(args) == 1:
host_address = args[0]