Repository: incubator-ranger Updated Branches: refs/heads/master ce5f434f5 -> 5e565cdde
RANGER-1092 : Ranger YARN Plugin should not fails to download policy when UGI ticket expires Project: http://git-wip-us.apache.org/repos/asf/incubator-ranger/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ranger/commit/5e565cdd Tree: http://git-wip-us.apache.org/repos/asf/incubator-ranger/tree/5e565cdd Diff: http://git-wip-us.apache.org/repos/asf/incubator-ranger/diff/5e565cdd Branch: refs/heads/master Commit: 5e565cdde09febdd86dc30de44ccf3607cb1db17 Parents: ce5f434 Author: rmani <rm...@hortonworks.com> Authored: Fri Jul 8 17:30:00 2016 -0700 Committer: rmani <rm...@hortonworks.com> Committed: Fri Jul 8 17:30:00 2016 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/ranger/audit/provider/MiscUtil.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/5e565cdd/agents-audit/src/main/java/org/apache/ranger/audit/provider/MiscUtil.java ---------------------------------------------------------------------- diff --git a/agents-audit/src/main/java/org/apache/ranger/audit/provider/MiscUtil.java b/agents-audit/src/main/java/org/apache/ranger/audit/provider/MiscUtil.java index 7c48055..535894c 100644 --- a/agents-audit/src/main/java/org/apache/ranger/audit/provider/MiscUtil.java +++ b/agents-audit/src/main/java/org/apache/ranger/audit/provider/MiscUtil.java @@ -489,7 +489,7 @@ public class MiscUtil { // in when the token is scheduled to expire. So it is better // to get the user object every time from UserGroupInformation class and // not cache it - return UserGroupInformation.getLoginUser(); + return getLoginUser(); } catch (IOException e) { logger.error("Error getting UGI.", e); } @@ -779,6 +779,12 @@ public class MiscUtil { } } + public static UserGroupInformation getLoginUser() throws IOException { + UserGroupInformation ugi = UserGroupInformation.getLoginUser(); + ugi.checkTGTAndReloginFromKeytab(); + return ugi; + } + private static void initLocalHost() { if ( logger.isDebugEnabled() ) { logger.debug("==> MiscUti.initLocalHost()");