From 1f87057248803bdce060ab5fc549db587579a70e Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Tue, 28 Apr 2015 14:23:09 +0200 Subject: [PATCH] marvin: set ssl cert verification only if ssl module supports it ssl._create_unverified_context is not available for all Python 2.x environment, the fix would check if the attribute is available before trying to set it Signed-off-by: Rohit Yadav --- tools/marvin/marvin/lib/vcenter.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/marvin/marvin/lib/vcenter.py b/tools/marvin/marvin/lib/vcenter.py index 85b50b39a3c..f7e09873d5e 100644 --- a/tools/marvin/marvin/lib/vcenter.py +++ b/tools/marvin/marvin/lib/vcenter.py @@ -19,7 +19,8 @@ from pyVmomi import vim, vmodl from pyVim import connect import atexit import ssl -ssl._create_default_https_context = ssl._create_unverified_context +if hasattr(ssl, '_create_unverified_context'): + ssl._create_default_https_context = ssl._create_unverified_context class Vcenter():