You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/11/07 20:52:12 UTC
[49/55] [abbrv] ambari git commit: AMBARI-18770. Service check and
Ambari Alerting for RM fails against Yarn with HA and SPNEGO. (Attila Magyar
via stoader)
AMBARI-18770. Service check and Ambari Alerting for RM fails against Yarn with HA and SPNEGO. (Attila Magyar via stoader)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d99df76a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d99df76a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d99df76a
Branch: refs/heads/branch-dev-patch-upgrade
Commit: d99df76a8731662f89eb1668cf9144b9317cfd4a
Parents: f87ec89
Author: Attila Magyar <am...@hortonworks.com>
Authored: Mon Nov 7 16:54:48 2016 +0100
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Mon Nov 7 17:02:37 2016 +0100
----------------------------------------------------------------------
.../libraries/functions/curl_krb_request.py | 4 ++--
.../YARN/2.1.0.2.0/package/scripts/service_check.py | 4 ++--
.../services/WEBHCAT/package/files/alert_webhcat_server.py | 4 ++--
.../python/stacks/2.0.6/YARN/test_yarn_service_check.py | 9 ++++++++-
4 files changed, 14 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d99df76a/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py b/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
index 2acf871..557db58 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/curl_krb_request.py
@@ -176,11 +176,11 @@ def curl_krb_request(tmp_dir, keytab, principal, url, cache_file_prefix,
try:
if return_only_http_code:
- _, curl_stdout, curl_stderr = get_user_call_output(['curl', '-L', '-k', '--negotiate', '-u', ':', '-b', cookie_file, '-c', cookie_file, '-w',
+ _, curl_stdout, curl_stderr = get_user_call_output(['curl', '--location-trusted', '-k', '--negotiate', '-u', ':', '-b', cookie_file, '-c', cookie_file, '-w',
'%{http_code}', url, '--connect-timeout', str(connection_timeout), '--max-time', str(maximum_timeout), '-o', '/dev/null'],
user=user, env=kerberos_env)
else:
- curl_command = ['curl', '-L', '-k', '--negotiate', '-u', ':', '-b', cookie_file, '-c', cookie_file,
+ curl_command = ['curl', '--location-trusted', '-k', '--negotiate', '-u', ':', '-b', cookie_file, '-c', cookie_file,
url, '--connect-timeout', str(connection_timeout), '--max-time', str(maximum_timeout)]
# returns response body
if len(method) > 0 and len(body) == 0 and len(header) == 0:
http://git-wip-us.apache.org/repos/asf/ambari/blob/d99df76a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
index 184d038..c0bd480 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py
@@ -133,13 +133,13 @@ class ServiceCheckDefault(ServiceCheck):
for rm_webapp_address in params.rm_webapp_addresses_list:
info_app_url = params.scheme + "://" + rm_webapp_address + "/ws/v1/cluster/apps/" + application_name
- get_app_info_cmd = "curl --negotiate -u : -ksL --connect-timeout " + CURL_CONNECTION_TIMEOUT + " " + info_app_url
+ get_app_info_cmd = "curl --negotiate -u : -ks --location-trusted --connect-timeout " + CURL_CONNECTION_TIMEOUT + " " + info_app_url
return_code, stdout, _ = get_user_call_output(get_app_info_cmd,
user=params.smokeuser,
path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
)
-
+
# Handle HDP<2.2.8.1 where RM doesn't do automatic redirection from standby to active
if stdout.startswith("This is standby RM. Redirecting to the current active RM:"):
Logger.info(format("Skipped checking of {rm_webapp_address} since returned '{stdout}'"))
http://git-wip-us.apache.org/repos/asf/ambari/blob/d99df76a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/WEBHCAT/package/files/alert_webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/WEBHCAT/package/files/alert_webhcat_server.py b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/WEBHCAT/package/files/alert_webhcat_server.py
index 7ee375e..a8d4dfe 100644
--- a/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/WEBHCAT/package/files/alert_webhcat_server.py
+++ b/ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/WEBHCAT/package/files/alert_webhcat_server.py
@@ -146,7 +146,7 @@ def execute(configurations={}, parameters={}, host_name=None):
Execute(kinit_command)
# make a single curl call to get just the http code
- curl = subprocess.Popen(['curl', '--negotiate', '-u', ':', '-sL', '-w',
+ curl = subprocess.Popen(['curl', '--negotiate', '-u', ':', '-s', '-w', '--location-trusted',
'%{http_code}', '--connect-timeout', curl_connection_timeout,
'-o', '/dev/null', query_url], stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=kerberos_env)
@@ -170,7 +170,7 @@ def execute(configurations={}, parameters={}, host_name=None):
# now that we have the http status and it was 200, get the content
start_time = time.time()
- curl = subprocess.Popen(['curl', '--negotiate', '-u', ':', '-sL',
+ curl = subprocess.Popen(['curl', '--negotiate', '-u', ':', '-s', '--location-trusted',
'--connect-timeout', curl_connection_timeout, query_url, ],
stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=kerberos_env)
http://git-wip-us.apache.org/repos/asf/ambari/blob/d99df76a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
index ccd472c..bb671aa 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py
@@ -22,9 +22,11 @@ import re
from mock.mock import MagicMock, call, patch
from stacks.utils.RMFTestCase import *
+curl_call = MagicMock(return_value=(0, "{ \"app\": {\"state\": \"FINISHED\",\"finalStatus\": \"SUCCEEDED\"}}",''))
+
@patch("platform.linux_distribution", new = MagicMock(return_value="Linux"))
@patch("sys.executable", new = '/usr/bin/python2.6')
-@patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", new = MagicMock(return_value=(0, "{ \"app\": {\"state\": \"FINISHED\",\"finalStatus\": \"SUCCEEDED\"}}",'')))
+@patch("resource_management.libraries.functions.get_user_call_output.get_user_call_output", new = curl_call)
class TestServiceCheck(RMFTestCase):
COMMON_SERVICES_PACKAGE_DIR = "YARN/2.1.0.2.0/package"
STACK_VERSION = "2.0.6"
@@ -59,6 +61,7 @@ class TestServiceCheck(RMFTestCase):
hadoop_conf_dir = '/etc/hadoop/conf',
type = 'directory',
)
+ self.assertCurlCallForwardsCredentialsOnRedirect()
self.assertNoMoreResources()
@@ -91,4 +94,8 @@ class TestServiceCheck(RMFTestCase):
hadoop_conf_dir = '/etc/hadoop/conf',
type = 'directory',
)
+ self.assertCurlCallForwardsCredentialsOnRedirect()
self.assertNoMoreResources()
+
+ def assertCurlCallForwardsCredentialsOnRedirect(self):
+ self.assertIn('--location-trusted', curl_call.call_args[0][0])
\ No newline at end of file