You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jo...@apache.org on 2017/05/18 14:01:48 UTC
[07/24] ambari git commit: AMBARI-21012. Fix Livy service check and
alerts script with SSL enabled (Saisai Shao via smohanty)
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/350dace6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/350dace6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/350dace6
Branch: refs/heads/branch-feature-AMBARI-12556
Commit: 350dace643e3edad2407c80f38edad5847b47706
Parents: 704eb52
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Tue May 16 19:20:24 2017 -0700
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Tue May 16 19:20:24 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/350dace6/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/350dace6/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 42396bd..74fd76a 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
@@ -242,6 +242,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/350dace6/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 9d74779..4699b2e 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
@@ -43,7 +43,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/350dace6/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/350dace6/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 1df3f2f..74790ef 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
@@ -229,6 +229,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/350dace6/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 8e7a766..7667191 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
@@ -44,7 +44,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,