Repository: ambari Updated Branches: refs/heads/trunk 93b068c87 -> 8e7a1db1b
AMBARI-15616. App Timeline Web UI Warning Alert is always present after Disabling security a few times.(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8e7a1db1 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8e7a1db1 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8e7a1db1 Branch: refs/heads/trunk Commit: 8e7a1db1b0add2fc29af668a70363baed86f0008 Parents: 93b068c Author: Vitaly Brodetskyi <[email protected]> Authored: Wed Mar 30 15:52:09 2016 +0300 Committer: Vitaly Brodetskyi <[email protected]> Committed: Wed Mar 30 15:52:09 2016 +0300 ---------------------------------------------------------------------- .../libraries/functions/curl_krb_request.py | 8 +++++++- .../KERBEROS/1.10.3-10/package/scripts/kerberos_client.py | 2 ++ .../KERBEROS/1.10.3-10/package/scripts/kerberos_common.py | 10 ++++++++++ .../python/stacks/2.2/KERBEROS/test_kerberos_client.py | 3 ++- 4 files changed, 21 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/8e7a1db1/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 21cdd09..cf0d5a6 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 @@ -99,7 +99,13 @@ def curl_krb_request(tmp_dir, keytab, principal, url, cache_file_prefix, # to generate a (relatively) unique cache filename so that we can use it as needed. Scope # this file by user in order to prevent sharing of cache files by multiple users. ccache_file_name = _md5("{0}|{1}".format(principal, keytab)).hexdigest() - ccache_file_path = "{0}{1}{2}_{3}_cc_{4}".format(tmp_dir, os.sep, cache_file_prefix, user, ccache_file_name) + + curl_krb_cache_path = os.path.join(tmp_dir, "curl_krb_cache") + if not os.path.exists(curl_krb_cache_path): + os.makedirs(curl_krb_cache_path) + os.chmod(curl_krb_cache_path, 0777) + + ccache_file_path = "{0}{1}{2}_{3}_cc_{4}".format(curl_krb_cache_path, os.sep, cache_file_prefix, user, ccache_file_name) kerberos_env = {'KRB5CCNAME': ccache_file_path} # concurrent kinit's can cause the following error: http://git-wip-us.apache.org/repos/asf/ambari/blob/8e7a1db1/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py index 013aabc..5a398db 100644 --- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py +++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_client.py @@ -36,6 +36,8 @@ class KerberosClient(KerberosScript): env.set_params(params) if params.manage_krb5_conf: self.write_krb5_conf() + #delete krb cache to prevent using old krb tickets on fresh kerberos setup + self.clear_tmp_cache() self.setup_jce() http://git-wip-us.apache.org/repos/asf/ambari/blob/8e7a1db1/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py index b72c4bf..e06b13f 100644 --- a/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py +++ b/ambari-server/src/main/resources/common-services/KERBEROS/1.10.3-10/package/scripts/kerberos_common.py @@ -23,10 +23,12 @@ import string import subprocess import sys import tempfile +from tempfile import gettempdir from resource_management import * from utils import get_property_value from ambari_commons.os_utils import remove_file +from ambari_agent import Constants class KerberosScript(Script): KRB5_REALM_PROPERTIES = [ @@ -284,6 +286,14 @@ class KerberosScript(Script): return success @staticmethod + def clear_tmp_cache(): + tmp_dir = Constants.AGENT_TMP_DIR + if tmp_dir is None: + tmp_dir = gettempdir() + curl_krb_cache_path = os.path.join(tmp_dir, "curl_krb_cache") + Directory(curl_krb_cache_path, action="delete") + + @staticmethod def create_principals(identities, auth_identity=None): if identities is not None: for identity in identities: http://git-wip-us.apache.org/repos/asf/ambari/blob/8e7a1db1/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py b/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py index b3b7940..0c52e73 100644 --- a/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py +++ b/ambari-server/src/test/python/stacks/2.2/KERBEROS/test_kerberos_client.py @@ -94,7 +94,8 @@ class TestKerberosClient(RMFTestCase): stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES ) - + self.assertResourceCalled('Directory', '/var/lib/ambari-agent/tmp/curl_krb_cache', action=["delete"], + ) self.assertResourceCalled('Directory', '/tmp/AMBARI-artifacts/', create_parents = True, )
