Module: check_mk
Branch: master
Commit: 757ab199804361becbda209ab3a25d984bdb8547
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=757ab199804361…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Feb 20 20:10:11 2019 +0100
retrieve_systeminfo returns gathered result now instead of modifying global structure
Change-Id: I3e1d81ae0a4805d890c1eee2e6dee792ca00ad0d
---
agents/special/agent_vsphere | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index d2be352..527887c 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -1019,13 +1019,15 @@ def connect_to_server():
def retrieve_systeminfo():
- # Retrieve basic data, which requires no login
+ """Retrieve basic data, which requires no login"""
+ system_info = {}
payload = telegram_list["systeminfo"]
_reply_code, _reply_msg, _reply_headers, reply_data = query_server(payload)
for entry in systemfields:
element = get_pattern("<%(entry)s.*>(.*)</%(entry)s>" %
{"entry": entry}, reply_data)
if element:
- systeminfo[entry] = element[0]
+ system_info[entry] = element[0]
+ return system_info
def login():
@@ -1281,8 +1283,6 @@ systemfields = [
"osType",
]
-systeminfo = {}
-
if opt_tracefile:
tracefile_dir = os.path.dirname(opt_tracefile) or "."
if os.path.exists(tracefile_dir):
@@ -1302,7 +1302,7 @@ host_cookie_path = Path(
try:
server_handle = connect_to_server()
- retrieve_systeminfo()
+ systeminfo = retrieve_systeminfo()
if not systeminfo:
sys.stderr.write("Unable to get data from Web API" + "\n")