Module: check_mk
Branch: master
Commit: a499ce9cfd89b75cdff67e3163a8a951bbf5c41c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a499ce9cfd89b7…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Fri Jul 3 13:22:19 2015 +0200
updated #2398: improved fallback when ssl is not working
---
agents/special/agent_vsphere | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/agents/special/agent_vsphere b/agents/special/agent_vsphere
index c06721d..803a5a8 100755
--- a/agents/special/agent_vsphere
+++ b/agents/special/agent_vsphere
@@ -660,9 +660,12 @@ def encode_url(text):
try:
netloc = host_address + ":" + str(opt_port)
- if opt_no_cert and hasattr(ssl, '_create_unverified_context'):
- import ssl
- server_handle = httplib.HTTPSConnection(netloc, context =
ssl._create_unverified_context())
+ if opt_no_cert:
+ try:
+ import ssl
+ server_handle = httplib.HTTPSConnection(netloc, context =
ssl._create_unverified_context())
+ except:
+ server_handle = httplib.HTTPSConnection(netloc)
else:
server_handle = httplib.HTTPSConnection(netloc)