You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2018/05/11 09:43:25 UTC

[ambari] branch trunk updated: AMBARI-23819. Ambari Agent registration task is failing (aonishuk)

This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ee18bba  AMBARI-23819. Ambari Agent registration task is failing  (aonishuk)
ee18bba is described below

commit ee18bba42bac9422c09ffe0d4aff8d6e1f44c23e
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Fri May 11 10:49:22 2018 +0300

    AMBARI-23819. Ambari Agent registration task is failing  (aonishuk)
---
 ambari-agent/src/main/python/ambari_agent/NetUtil.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ambari-agent/src/main/python/ambari_agent/NetUtil.py b/ambari-agent/src/main/python/ambari_agent/NetUtil.py
index 7c8a4e4..9282535 100644
--- a/ambari-agent/src/main/python/ambari_agent/NetUtil.py
+++ b/ambari-agent/src/main/python/ambari_agent/NetUtil.py
@@ -17,7 +17,7 @@
 from urlparse import urlparse
 import logging
 import httplib
-import sys
+import ssl
 from ssl import SSLError
 from ambari_agent.AmbariConfig import AmbariConfig
 from ambari_commons.inet_utils import ensure_ssl_using_protocol
@@ -66,8 +66,8 @@ class NetUtil:
     try:
       parsedurl = urlparse(url)
 
-      if sys.version_info >= (2,7,5) and not ssl_verify_cert:
-          import ssl
+      # hasattr being true means that current python version has default cert verification enabled.
+      if hasattr(ssl, '_create_unverified_context') and not ssl_verify_cert:
           ca_connection = httplib.HTTPSConnection(parsedurl[1], context=ssl._create_unverified_context())
       else:
           ca_connection = httplib.HTTPSConnection(parsedurl[1])

-- 
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.