ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject [1/2] ambari git commit: AMBARI-14236. HDFS and Yarn alerts in https mode when kerberos is disabled (aonishuk)
Date Sun, 06 Dec 2015 15:12:09 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 e50b5b874 -> cf03a2ba7
  refs/heads/trunk ec2ba540e -> 85a14993d


AMBARI-14236. HDFS and Yarn alerts in https mode when kerberos is disabled (aonishuk)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/85a14993
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/85a14993
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/85a14993

Branch: refs/heads/trunk
Commit: 85a14993d6eb848b69b6717512f792f62ff5978f
Parents: ec2ba54
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Sun Dec 6 17:11:57 2015 +0200
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Sun Dec 6 17:11:57 2015 +0200

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/alerts/web_alert.py    | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/85a14993/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py b/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
index 0d627c3..502526c 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/web_alert.py
@@ -22,6 +22,8 @@ import logging
 import time
 import os
 import urllib2
+import ssl
+from functools import wraps
 from urllib2 import HTTPError
 
 from  tempfile import gettempdir
@@ -51,6 +53,16 @@ DEFAULT_CONNECTION_TIMEOUT = 5
 
 WebResponse = namedtuple('WebResponse', 'status_code time_millis error_msg')
 
+# patch ssl module to fix SSLv3 communication bug
+# for more info see http://stackoverflow.com/questions/9835506/urllib-urlopen-works-on-sslv3-urls-with-python-2-6-6-on-1-machine-but-not-wit
+def sslwrap(func):
+    @wraps(func)
+    def bar(*args, **kw):
+        kw['ssl_version'] = ssl.PROTOCOL_TLSv1
+        return func(*args, **kw)
+    return bar
+ssl.wrap_socket = sslwrap(ssl.wrap_socket)
+
 class WebAlert(BaseAlert):
 
   def __init__(self, alert_meta, alert_source_meta, config):


Mime
View raw message