You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by rl...@apache.org on 2018/07/11 16:20:04 UTC

[ambari] branch trunk updated: [AMBARI-24207] Python unit test failure on 2.7.6

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

rlevas 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 c9596bd  [AMBARI-24207] Python unit test failure on 2.7.6
c9596bd is described below

commit c9596bd632a70714d9384f0bc9525f4554a13964
Author: Robert Levas <rl...@users.noreply.github.com>
AuthorDate: Wed Jul 11 12:19:58 2018 -0400

    [AMBARI-24207] Python unit test failure on 2.7.6
    
    * [AMBARI-24207] Python unit test failure on 2.7.6
    
    * [AMBARI-24207] Python unit test failure on 2.7.6
---
 ambari-server/src/main/python/ambari_server/serverUtils.py |  2 +-
 ambari-server/src/test/python/TestServerUtils.py           | 14 +++++++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ambari-server/src/main/python/ambari_server/serverUtils.py b/ambari-server/src/main/python/ambari_server/serverUtils.py
index be9fcde..7d2370e 100644
--- a/ambari-server/src/main/python/ambari_server/serverUtils.py
+++ b/ambari-server/src/main/python/ambari_server/serverUtils.py
@@ -245,7 +245,7 @@ def get_ssl_context(properties, requested_protocol=None):
   :return: a permissive SSLContext or None
   """
 
-  if not is_api_ssl_enabled(properties):
+  if not is_api_ssl_enabled(properties) or not hasattr(ssl, 'SSLContext'):
     return None
 
   if requested_protocol:
diff --git a/ambari-server/src/test/python/TestServerUtils.py b/ambari-server/src/test/python/TestServerUtils.py
index cb548a0..0704272 100644
--- a/ambari-server/src/test/python/TestServerUtils.py
+++ b/ambari-server/src/test/python/TestServerUtils.py
@@ -122,11 +122,19 @@ class TestServerUtils(TestCase):
       SSL_API: "true"
     })
     context = get_ssl_context(properties)
-    self.assertIsNotNone(context)
+    if hasattr(ssl, 'SSLContext'):
+      self.assertIsNotNone(context)
+    else:
+      self.assertIsNone(context)
 
     context = get_ssl_context(properties, ssl.PROTOCOL_TLSv1)
-    self.assertIsNotNone(context)
-    self.assertEqual(ssl.PROTOCOL_TLSv1, context.protocol)
+    if hasattr(ssl, 'SSLContext'):
+      self.assertIsNotNone(context)
+      self.assertEqual(ssl.PROTOCOL_TLSv1, context.protocol)
+    else:
+      self.assertIsNone(context)
+
+
 
     properties = FakeProperties({
       SSL_API: "false"