YARN-6271. yarn rmadin -getGroups returns information from standby RM. Contributed by Jian He.

This commit is contained in:
Junping Du 2017-03-03 14:39:31 -08:00 committed by Anu Engineer
parent 09cfa79dbd
commit b8123b0323
1 changed files with 9 additions and 0 deletions

View File

@ -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();
}