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

hapylestat 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 ad5abae  [AMBARI-25315][AMBARI-25211] Fix the logic on constucting 
JDBC URL for Spark2 thrift server alert (#3021)
ad5abae is described below

commit ad5abae4392822736b130a9577037d2714a829cd
Author: Jungtaek Lim <kabh...@gmail.com>
AuthorDate: Mon Jun 24 17:15:13 2019 +0900

    [AMBARI-25315][AMBARI-25211] Fix the logic on constucting JDBC URL for 
Spark2 thrift server alert (#3021)
    
    [AMBARI-25315] Fix the logic on constucting JDBC URL for Spark2 thrift 
server alert (Jungtaek Lim via dgrinenko)
---
 .../scripts/alerts/alert_spark2_thrift_port.py        | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git 
a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
 
b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
index dbbbabf..92d5ef3 100644
--- 
a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
+++ 
b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_thrift_port.py
@@ -147,22 +147,19 @@ def execute(configurations={}, parameters={}, 
host_name=None):
         if host_name is None:
             host_name = socket.getfqdn()
 
+        beeline_url = ["jdbc:hive2://{host_name}:{port}/default", 
"transportMode={transport_mode}"]
         if security_enabled:
+            beeline_url.append("principal={hive_principal}")
+        if transport_mode == "http":
+            beeline_url.append("httpPath=cliservice")
             if spark_ssl_enabled:
-                beeline_url = 
['"jdbc:hive2://{host_name}:{port}/default;principal={hive_principal};transportMode={transport_mode};ssl=true;sslTrustStore={spark_truststore_path};trustStorePassword={spark_truststore_pass!p};httpPath=cliservice"']
-            else:
-                beeline_url = 
["jdbc:hive2://{host_name}:{port}/default;principal={hive_principal}","transportMode={transport_mode}"]
-        else:
-            if spark_ssl_enabled:
-                beeline_url = 
['"jdbc:hive2://{host_name}:{port}/default;transportMode={transport_mode};ssl=true;sslTrustStore={spark_truststore_path};trustStorePassword={spark_truststore_pass!p};httpPath=cliservice"']
-            else:
-                beeline_url = 
["jdbc:hive2://{host_name}:{port}/default","transportMode={transport_mode}"]
-                
+                beeline_url.extend(["ssl=true", 
"sslTrustStore={spark_truststore_path}", 
"trustStorePassword={spark_truststore_pass!p}"])
+
         # append url according to used transport
 
         beeline_cmd = os.path.join(spark_home, "bin", "beeline")
-        cmd = "! beeline -u %s  -e '' 2>&1| awk '{print}'|grep -i -e 
'Connection refused' -e 'Invalid URL'" % \
-              (format(" ".join(beeline_url)))
+        cmd = "! beeline -u '%s'  -e '' 2>&1| awk '{print}'|grep -i -e 
'Connection refused' -e 'Invalid URL'" % \
+              (format(";".join(beeline_url)))
 
         start_time = time.time()
         try:

Reply via email to