Merge r1553596 from trunk. Fixed yarn rmadmin command to print the correct usage info. Contributed by Akira AJISAKA.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-2@1553597 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jian He 2013-12-26 22:15:41 +00:00
parent 1e6b49ee8b
commit 59df96e4e3
3 changed files with 18 additions and 15 deletions

View File

@ -251,6 +251,9 @@ Release 2.4.0 - UNRELEASED
YARN-1451. TestResourceManager relies on the scheduler assigning multiple YARN-1451. TestResourceManager relies on the scheduler assigning multiple
containers in a single node update. (Sandy Ryza via kasha) containers in a single node update. (Sandy Ryza via kasha)
YARN-1527. Fix yarn rmadmin command to print the correct usage info.
(Akira AJISAKA via jianhe)
Release 2.3.0 - UNRELEASED Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -122,13 +122,13 @@ public class RMAdminCLI extends HAAdmin {
} }
} }
String space = (usageInfo.args == "") ? "" : " "; String space = (usageInfo.args == "") ? "" : " ";
builder.append("Usage: java RMAdmin [" builder.append("Usage: yarn rmadmin ["
+ cmd + space + usageInfo.args + cmd + space + usageInfo.args
+ "]\n"); + "]\n");
} }
private static void buildUsageMsg(StringBuilder builder) { private static void buildUsageMsg(StringBuilder builder) {
builder.append("Usage: java RMAdmin"); builder.append("Usage: yarn rmadmin\n");
for (String cmdKey : ADMIN_USAGE.keySet()) { for (String cmdKey : ADMIN_USAGE.keySet()) {
UsageInfo usageInfo = ADMIN_USAGE.get(cmdKey); UsageInfo usageInfo = ADMIN_USAGE.get(cmdKey);
builder.append(" " + cmdKey + " " + usageInfo.args + "\n"); builder.append(" " + cmdKey + " " + usageInfo.args + "\n");

View File

@ -241,37 +241,37 @@ public class TestRMAdminCLI {
"commands if none")); "commands if none"));
testError(new String[] { "-help", "-refreshQueues" }, testError(new String[] { "-help", "-refreshQueues" },
"Usage: java RMAdmin [-refreshQueues]", dataErr, 0); "Usage: yarn rmadmin [-refreshQueues]", dataErr, 0);
testError(new String[] { "-help", "-refreshNodes" }, testError(new String[] { "-help", "-refreshNodes" },
"Usage: java RMAdmin [-refreshNodes]", dataErr, 0); "Usage: yarn rmadmin [-refreshNodes]", dataErr, 0);
testError(new String[] { "-help", "-refreshUserToGroupsMappings" }, testError(new String[] { "-help", "-refreshUserToGroupsMappings" },
"Usage: java RMAdmin [-refreshUserToGroupsMappings]", dataErr, 0); "Usage: yarn rmadmin [-refreshUserToGroupsMappings]", dataErr, 0);
testError( testError(
new String[] { "-help", "-refreshSuperUserGroupsConfiguration" }, new String[] { "-help", "-refreshSuperUserGroupsConfiguration" },
"Usage: java RMAdmin [-refreshSuperUserGroupsConfiguration]", "Usage: yarn rmadmin [-refreshSuperUserGroupsConfiguration]",
dataErr, 0); dataErr, 0);
testError(new String[] { "-help", "-refreshAdminAcls" }, testError(new String[] { "-help", "-refreshAdminAcls" },
"Usage: java RMAdmin [-refreshAdminAcls]", dataErr, 0); "Usage: yarn rmadmin [-refreshAdminAcls]", dataErr, 0);
testError(new String[] { "-help", "-refreshServiceAcl" }, testError(new String[] { "-help", "-refreshServiceAcl" },
"Usage: java RMAdmin [-refreshServiceAcl]", dataErr, 0); "Usage: yarn rmadmin [-refreshServiceAcl]", dataErr, 0);
testError(new String[] { "-help", "-getGroups" }, testError(new String[] { "-help", "-getGroups" },
"Usage: java RMAdmin [-getGroups [username]]", dataErr, 0); "Usage: yarn rmadmin [-getGroups [username]]", dataErr, 0);
testError(new String[] { "-help", "-transitionToActive" }, testError(new String[] { "-help", "-transitionToActive" },
"Usage: java RMAdmin [-transitionToActive <serviceId>]", dataErr, 0); "Usage: yarn rmadmin [-transitionToActive <serviceId>]", dataErr, 0);
testError(new String[] { "-help", "-transitionToStandby" }, testError(new String[] { "-help", "-transitionToStandby" },
"Usage: java RMAdmin [-transitionToStandby <serviceId>]", dataErr, 0); "Usage: yarn rmadmin [-transitionToStandby <serviceId>]", dataErr, 0);
testError(new String[] { "-help", "-getServiceState" }, testError(new String[] { "-help", "-getServiceState" },
"Usage: java RMAdmin [-getServiceState <serviceId>]", dataErr, 0); "Usage: yarn rmadmin [-getServiceState <serviceId>]", dataErr, 0);
testError(new String[] { "-help", "-checkHealth" }, testError(new String[] { "-help", "-checkHealth" },
"Usage: java RMAdmin [-checkHealth <serviceId>]", dataErr, 0); "Usage: yarn rmadmin [-checkHealth <serviceId>]", dataErr, 0);
testError(new String[] { "-help", "-failover" }, testError(new String[] { "-help", "-failover" },
"Usage: java RMAdmin " + "Usage: yarn rmadmin " +
"[-failover [--forcefence] [--forceactive] " + "[-failover [--forcefence] [--forceactive] " +
"<serviceId> <serviceId>]", "<serviceId> <serviceId>]",
dataErr, 0); dataErr, 0);
testError(new String[] { "-help", "-badParameter" }, testError(new String[] { "-help", "-badParameter" },
"Usage: java RMAdmin", dataErr, 0); "Usage: yarn rmadmin", dataErr, 0);
testError(new String[] { "-badParameter" }, testError(new String[] { "-badParameter" },
"badParameter: Unknown command", dataErr, -1); "badParameter: Unknown command", dataErr, -1);
} finally { } finally {