From 06d70ad95af65ddd79ed87e24d0b168b43f94a5c Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Tue, 11 Jul 2017 14:29:01 -0400 Subject: [PATCH] Include found python and version in SSL_CONTEXT warning. (#24252) Based on issue 23642, add some info about the used python executable and version to the error message when ssl connection fail in a way that may be related to the version. --- lib/ansible/module_utils/urls.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/ansible/module_utils/urls.py b/lib/ansible/module_utils/urls.py index 9de91d244e5..9934ba127a6 100644 --- a/lib/ansible/module_utils/urls.py +++ b/lib/ansible/module_utils/urls.py @@ -571,6 +571,8 @@ def build_ssl_validation_error(hostname, port, paths, exc=None): if not HAS_SSLCONTEXT: msg.append('If the website serving the url uses SNI you need' ' python >= 2.7.9 on your managed machine') + msg.append(' (the python executable used (%s) is version: %s)' % + (sys.executable, ''.join(sys.version.splitlines()))) if not HAS_URLLIB3_PYOPENSSLCONTEXT or not HAS_URLLIB3_SSL_WRAP_SOCKET: msg.append('or you can install the `urllib3`, `pyOpenSSL`,' ' `ndg-httpsclient`, and `pyasn1` python modules')