Repository: ambari Updated Branches: refs/heads/branch-2.2 579324dec -> a9e65decf
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/a9e65dec Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a9e65dec Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a9e65dec Branch: refs/heads/branch-2.2 Commit: a9e65decfe82c7d8a35efd364b34269bc615908a Parents: 579324d Author: Vitaly Brodetskyi <[email protected]> Authored: Wed Mar 30 16:00:13 2016 +0300 Committer: Vitaly Brodetskyi <[email protected]> Committed: Wed Mar 30 16:00:13 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/a9e65dec/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 685c8a6..926cfb0 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/a9e65dec/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 580545d..94541a1 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/a9e65dec/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 d40627a..e606064 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/a9e65dec/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 105e741..b71cce7 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 @@ -92,7 +92,8 @@ class TestKerberosClient(RMFTestCase): hdp_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/', recursive = True, )
