From 8db7a8c3aea3d989361f32cca5b271e9653773b6 Mon Sep 17 00:00:00 2001 From: Junping Du Date: Fri, 3 Mar 2017 14:39:31 -0800 Subject: [PATCH] YARN-6271. yarn rmadin -getGroups returns information from standby RM. Contributed by Jian He. --- .../hadoop/yarn/server/resourcemanager/AdminService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java index 9dda57e2d22..bcf7309f883 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java @@ -572,6 +572,15 @@ public class AdminService extends CompositeService implements @Override public String[] getGroupsForUser(String user) throws IOException { + String operation = "getGroupsForUser"; + UserGroupInformation ugi; + try { + ugi = checkAcls(operation); + } catch (YarnException e) { + // The interface is from hadoop-common which does not accept YarnException + throw new IOException(e); + } + checkRMStatus(ugi.getShortUserName(), operation, "get groups for user"); return UserGroupInformation.createRemoteUser(user).getGroupNames(); }