ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smoha...@apache.org
Subject ambari git commit: AMBARI-21012. Fix Livy service check and alerts script with SSL enabled (Saisai Shao via smohanty)
Date Wed, 17 May 2017 02:23:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 7f745d5fe -> b6bc82b77


AMBARI-21012. Fix Livy service check and alerts script with SSL enabled (Saisai Shao via smohanty)


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

Branch: refs/heads/branch-2.5
Commit: b6bc82b77766c2351cbaeec7760d44f006de2d7e
Parents: 7f745d5
Author: Sumit Mohanty <smohanty@hortonworks.com>
Authored: Tue May 16 19:20:24 2017 -0700
Committer: Sumit Mohanty <smohanty@hortonworks.com>
Committed: Tue May 16 19:23:33 2017 -0700

----------------------------------------------------------------------
 .../1.2.1/package/scripts/alerts/alert_spark_livy_port.py      | 6 ++++--
 .../common-services/SPARK/1.2.1/package/scripts/params.py      | 1 +
 .../SPARK/1.2.1/package/scripts/service_check.py               | 2 +-
 .../2.0.0/package/scripts/alerts/alert_spark2_livy_port.py     | 6 ++++--
 .../common-services/SPARK2/2.0.0/package/scripts/params.py     | 1 +
 .../SPARK2/2.0.0/package/scripts/service_check.py              | 2 +-
 6 files changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b6bc82b7/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_livy_port.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_livy_port.py
b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_livy_port.py
index f15e747..f3a63b2 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_livy_port.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/alerts/alert_spark_livy_port.py
@@ -46,6 +46,7 @@ SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
 SMOKEUSER_KEYTAB_KEY = '{{cluster-env/smokeuser_keytab}}'
 SMOKEUSER_PRINCIPAL_KEY = '{{cluster-env/smokeuser_principal_name}}'
 SMOKEUSER_KEY = '{{cluster-env/smokeuser}}'
+LIVY_SSL_ENABLED_KEY = '{{livy-conf/livy.keystore}}'
 
 # The configured Kerberos executable search paths, if any
 KERBEROS_EXECUTABLE_SEARCH_PATHS_KEY = '{{kerberos-env/executable_search_paths}}'
@@ -57,7 +58,7 @@ def get_tokens():
     Returns a tuple of tokens in the format {{site/property}} that will be used
     to build the dictionary passed into execute
     """
-    return (LIVY_SERVER_PORT_KEY,LIVYUSER_DEFAULT,SECURITY_ENABLED_KEY,SMOKEUSER_KEYTAB_KEY,SMOKEUSER_PRINCIPAL_KEY,SMOKEUSER_KEY)
+    return (LIVY_SERVER_PORT_KEY,LIVYUSER_DEFAULT,SECURITY_ENABLED_KEY,SMOKEUSER_KEYTAB_KEY,SMOKEUSER_PRINCIPAL_KEY,SMOKEUSER_KEY,LIVY_SSL_ENABLED_KEY)
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def execute(configurations={}, parameters={}, host_name=None):
@@ -118,13 +119,14 @@ def execute(configurations={}, parameters={}, host_name=None):
         finally:
             kinit_lock.release()
 
+    http_scheme = 'https' if LIVY_SSL_ENABLED_KEY in configurations else 'http'
     result_code = None
     try:
         start_time = time.time()
         try:
             livy_livyserver_host = str(host_name)
 
-            livy_cmd = format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k
http://{livy_livyserver_host}:{port}/sessions | grep 200 ")
+            livy_cmd = format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k
{http_scheme}://{livy_livyserver_host}:{port}/sessions | grep 200 ")
 
             Execute(livy_cmd,
                     tries=3,

http://git-wip-us.apache.org/repos/asf/ambari/blob/b6bc82b7/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/params.py
index fd473ad..b54b565 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/params.py
@@ -243,6 +243,7 @@ if stack_version_formatted and check_stack_feature(StackFeature.SPARK_LIVY,
stac
     livy_kerberos_principal = config['configurations']['livy-conf']['livy.server.launch.kerberos.principal']
 
   livy_livyserver_hosts = default("/clusterHostInfo/livy_server_hosts", [])
+  livy_http_scheme = 'https' if 'livy.keystore' in config['configurations']['livy-conf']
else 'http'
 
   # ats 1.5 properties
   entity_groupfs_active_dir = config['configurations']['yarn-site']['yarn.timeline-service.entity-group-fs-store.active-dir']

http://git-wip-us.apache.org/repos/asf/ambari/blob/b6bc82b7/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/service_check.py
b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/service_check.py
index 74473e0..8b74899 100644
--- a/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/SPARK/1.2.1/package/scripts/service_check.py
@@ -45,7 +45,7 @@ class SparkServiceCheck(Script):
       live_livyserver_host = "";
       for livyserver_host in params.livy_livyserver_hosts:
         try:
-          Execute(format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k http://{livyserver_host}:{livy_livyserver_port}/sessions
| grep 200"),
+          Execute(format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k {livy_http_scheme}://{livyserver_host}:{livy_livyserver_port}/sessions
| grep 200"),
               tries=3,
               try_sleep=1,
               logoutput=True,

http://git-wip-us.apache.org/repos/asf/ambari/blob/b6bc82b7/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_livy_port.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_livy_port.py
b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_livy_port.py
index d69f663..525ac3c 100644
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_livy_port.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/alerts/alert_spark2_livy_port.py
@@ -46,6 +46,7 @@ SECURITY_ENABLED_KEY = '{{cluster-env/security_enabled}}'
 SMOKEUSER_KEYTAB_KEY = '{{cluster-env/smokeuser_keytab}}'
 SMOKEUSER_PRINCIPAL_KEY = '{{cluster-env/smokeuser_principal_name}}'
 SMOKEUSER_KEY = '{{cluster-env/smokeuser}}'
+LIVY_SSL_ENABLED_KEY = '{{livy2-conf/livy.keystore}}'
 
 # The configured Kerberos executable search paths, if any
 KERBEROS_EXECUTABLE_SEARCH_PATHS_KEY = '{{kerberos-env/executable_search_paths}}'
@@ -57,7 +58,7 @@ def get_tokens():
     Returns a tuple of tokens in the format {{site/property}} that will be used
     to build the dictionary passed into execute
     """
-    return (LIVY_SERVER_PORT_KEY,LIVYUSER_DEFAULT,SECURITY_ENABLED_KEY,SMOKEUSER_KEYTAB_KEY,SMOKEUSER_PRINCIPAL_KEY,SMOKEUSER_KEY)
+    return (LIVY_SERVER_PORT_KEY,LIVYUSER_DEFAULT,SECURITY_ENABLED_KEY,SMOKEUSER_KEYTAB_KEY,SMOKEUSER_PRINCIPAL_KEY,SMOKEUSER_KEY,LIVY_SSL_ENABLED_KEY)
 
 @OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT)
 def execute(configurations={}, parameters={}, host_name=None):
@@ -118,13 +119,14 @@ def execute(configurations={}, parameters={}, host_name=None):
         finally:
             kinit_lock.release()
 
+    http_scheme = 'https' if LIVY_SSL_ENABLED_KEY in configurations else 'http'
     result_code = None
     try:
         start_time = time.time()
         try:
             livy2_livyserver_host = str(host_name)
 
-            livy_cmd = format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k
http://{livy2_livyserver_host}:{port}/sessions | grep 200 ")
+            livy_cmd = format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k
{http_scheme}://{livy2_livyserver_host}:{port}/sessions | grep 200 ")
 
             Execute(livy_cmd,
                     tries=3,

http://git-wip-us.apache.org/repos/asf/ambari/blob/b6bc82b7/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/params.py
b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/params.py
index 9f0c189..efbec0f 100755
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/params.py
@@ -233,6 +233,7 @@ if stack_version_formatted and check_stack_feature(StackFeature.SPARK_LIVY2,
sta
     livy_kerberos_principal = config['configurations']['livy2-conf']['livy.server.launch.kerberos.principal']
 
   livy2_livyserver_hosts = default("/clusterHostInfo/livy2_server_hosts", [])
+  livy2_http_scheme = 'https' if 'livy.keystore' in config['configurations']['livy2-conf']
else 'http'
 
   # ats 1.5 properties
   entity_groupfs_active_dir = config['configurations']['yarn-site']['yarn.timeline-service.entity-group-fs-store.active-dir']

http://git-wip-us.apache.org/repos/asf/ambari/blob/b6bc82b7/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/service_check.py
b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/service_check.py
index e6bd120..b6ec35c 100755
--- a/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/SPARK2/2.0.0/package/scripts/service_check.py
@@ -45,7 +45,7 @@ class SparkServiceCheck(Script):
       live_livyserver_host = ""
       for livyserver_host in params.livy2_livyserver_hosts:
         try:
-          Execute(format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k http://{livyserver_host}:{livy2_livyserver_port}/sessions
| grep 200"),
+          Execute(format("curl -s -o /dev/null -w'%{{http_code}}' --negotiate -u: -k {livy2_http_scheme}://{livyserver_host}:{livy2_livyserver_port}/sessions
| grep 200"),
                   tries=3,
                   try_sleep=1,
                   logoutput=True,


Mime
View raw message