Browse Source

AMBARI-5332. Print better logs for openssl issues on centos/rhel 6.5. (mahadev)

Mahadev Konar 11 years ago
parent
commit
8b763e1748
1 changed files with 8 additions and 1 deletions
  1. 8 1
      ambari-agent/src/main/python/ambari_agent/NetUtil.py

+ 8 - 1
ambari-agent/src/main/python/ambari_agent/NetUtil.py

@@ -18,6 +18,7 @@ from urlparse import urlparse
 import time
 import logging
 import httplib
+from ssl import SSLError
 
 logger = logging.getLogger()
 
@@ -51,8 +52,14 @@ class NetUtil:
         return True
       else: 
         return False
+    except SSLError as slerror:
+      logger.error(str(slerror))
+      logger.error("SSLError: Failed to connect. Please check openssl library versions. \n" +
+                   "Refer to: https://bugzilla.redhat.com/show_bug.cgi?id=1022468 for more details.")
+      return False
+    
     except Exception, e:
-      logger.info("Failed to connect to " + str(url) + " due to " + str(e))
+      logger.warning("Failed to connect to " + str(url) + " due to " + str(e) + "  ")
       return False
 
   def try_to_connect(self, server_url, max_retries, logger = None):