Module: check_mk
Branch: master
Commit: b13b8cc002187642a1b39d23db2e2b9b9d35c249
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b13b8cc0021876…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Wed Apr 10 08:31:12 2019 +0200
agent_vsphere: refactor for testing with tracefile (III)
Change-Id: I2ee59d8ec63afa0e836a98cee47dc7b1339234dc
---
agents/special/agent_vsphere | 15 +++++++--------
1 file changed, 7 insertions(+), 8 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index 3c4438f..40541f1 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -998,10 +998,11 @@ class ESXConnection(object):
def send_soapdata(self, soapdata, payload_params):
self._init_headers(soapdata)
-
response_data = []
- time_sent = time.time()
+ if tracefile:
+ tracefile.write("#### Sent ####\n%s" % soapdata)
+ time_sent = time.time()
self._server_handle.send(soapdata)
response = self._server_handle.getresponse()
@@ -1025,14 +1026,12 @@ class ESXConnection(object):
else:
break
- time_response = time.time()
-
+ respose_text = "".join(response_data)
if tracefile:
- tracefile.write("#### Sent ####\n%s" % soapdata)
- timing_info = "Response took: %f" % (time_response - time_sent)
- tracefile.write("\n#### Received #### %s\n%s\n" % (timing_info,
"".join(response_data)))
+ timing_info = "Response took: %f" % (time.time() - time_sent)
+ tracefile.write("\n#### Received #### %s\n%s\n" % (timing_info,
respose_text))
- return response, "".join(response_data)
+ return response, respose_text
def query_server(self, payload, payload_params=None):
soapdata, payload_params = self.prepare_soapdata(payload, payload_params)