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/19 09:10:20 UTC
[ambari] branch branch-2.7 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 branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new 881c82a [AMBARI-24207] Python unit test failure on 2.7.6
881c82a is described below
commit 881c82a30d9f2212d0736271e061fd5dd5c2cf0b
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"