From ad9895de0767d33612cbcfcb9b80226511ce721d Mon Sep 17 00:00:00 2001 From: Nitin Madhok Date: Sun, 9 Aug 2015 03:11:13 -0400 Subject: [PATCH] Display error in else condition if connection is unsuccessful and does not have msg attribute. Fixes #25809 --- salt/cloud/clouds/vmware.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/salt/cloud/clouds/vmware.py b/salt/cloud/clouds/vmware.py index 6378e14de2..9203c8ecc8 100644 --- a/salt/cloud/clouds/vmware.py +++ b/salt/cloud/clouds/vmware.py @@ -202,11 +202,13 @@ def _get_si(): port=port ) ssl._create_default_https_context = default_context - except: - err_msg = exc.msg if isinstance(exc, vim.fault.InvalidLogin) and hasattr(exc, 'msg') else 'Could not connect to the specified vCenter server. Please check the specified protocol or url or port' + except Exception as exc: + err_msg = exc.msg if hasattr(exc, 'msg') else 'Could not connect to the specified vCenter server. Please check the debug log for more information' + log.debug(exc) raise SaltCloudSystemExit(err_msg) else: - err_msg = exc.msg if isinstance(exc, vim.fault.InvalidLogin) and hasattr(exc, 'msg') else 'Could not connect to the specified vCenter server. Please check the specified protocol or url or port' + err_msg = exc.msg if hasattr(exc, 'msg') else 'Could not connect to the specified vCenter server. Please check the debug log for more information' + log.debug(exc) raise SaltCloudSystemExit(err_msg) atexit.register(Disconnect, si)