From 59df96e4e3069c28f1fc88b97ef81144ffaf0a82 Mon Sep 17 00:00:00 2001 From: Jian He Date: Thu, 26 Dec 2013 22:15:41 +0000 Subject: [PATCH] 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 --- hadoop-yarn-project/CHANGES.txt | 3 +++ .../hadoop/yarn/client/cli/RMAdminCLI.java | 4 +-- .../hadoop/yarn/client/TestRMAdminCLI.java | 26 +++++++++---------- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index dcd362b5fcc..936d26b9978 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -251,6 +251,9 @@ Release 2.4.0 - UNRELEASED YARN-1451. TestResourceManager relies on the scheduler assigning multiple 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 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java index 807841b2cf4..258650673f9 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/cli/RMAdminCLI.java @@ -122,13 +122,13 @@ public class RMAdminCLI extends HAAdmin { } } String space = (usageInfo.args == "") ? "" : " "; - builder.append("Usage: java RMAdmin [" + builder.append("Usage: yarn rmadmin [" + cmd + space + usageInfo.args + "]\n"); } private static void buildUsageMsg(StringBuilder builder) { - builder.append("Usage: java RMAdmin"); + builder.append("Usage: yarn rmadmin\n"); for (String cmdKey : ADMIN_USAGE.keySet()) { UsageInfo usageInfo = ADMIN_USAGE.get(cmdKey); builder.append(" " + cmdKey + " " + usageInfo.args + "\n"); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMAdminCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMAdminCLI.java index 94c87515f09..cec8fcc557a 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMAdminCLI.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/TestRMAdminCLI.java @@ -241,37 +241,37 @@ public class TestRMAdminCLI { "commands if none")); testError(new String[] { "-help", "-refreshQueues" }, - "Usage: java RMAdmin [-refreshQueues]", dataErr, 0); + "Usage: yarn rmadmin [-refreshQueues]", dataErr, 0); testError(new String[] { "-help", "-refreshNodes" }, - "Usage: java RMAdmin [-refreshNodes]", dataErr, 0); + "Usage: yarn rmadmin [-refreshNodes]", dataErr, 0); testError(new String[] { "-help", "-refreshUserToGroupsMappings" }, - "Usage: java RMAdmin [-refreshUserToGroupsMappings]", dataErr, 0); + "Usage: yarn rmadmin [-refreshUserToGroupsMappings]", dataErr, 0); testError( new String[] { "-help", "-refreshSuperUserGroupsConfiguration" }, - "Usage: java RMAdmin [-refreshSuperUserGroupsConfiguration]", + "Usage: yarn rmadmin [-refreshSuperUserGroupsConfiguration]", dataErr, 0); testError(new String[] { "-help", "-refreshAdminAcls" }, - "Usage: java RMAdmin [-refreshAdminAcls]", dataErr, 0); + "Usage: yarn rmadmin [-refreshAdminAcls]", dataErr, 0); testError(new String[] { "-help", "-refreshServiceAcl" }, - "Usage: java RMAdmin [-refreshServiceAcl]", dataErr, 0); + "Usage: yarn rmadmin [-refreshServiceAcl]", dataErr, 0); testError(new String[] { "-help", "-getGroups" }, - "Usage: java RMAdmin [-getGroups [username]]", dataErr, 0); + "Usage: yarn rmadmin [-getGroups [username]]", dataErr, 0); testError(new String[] { "-help", "-transitionToActive" }, - "Usage: java RMAdmin [-transitionToActive ]", dataErr, 0); + "Usage: yarn rmadmin [-transitionToActive ]", dataErr, 0); testError(new String[] { "-help", "-transitionToStandby" }, - "Usage: java RMAdmin [-transitionToStandby ]", dataErr, 0); + "Usage: yarn rmadmin [-transitionToStandby ]", dataErr, 0); testError(new String[] { "-help", "-getServiceState" }, - "Usage: java RMAdmin [-getServiceState ]", dataErr, 0); + "Usage: yarn rmadmin [-getServiceState ]", dataErr, 0); testError(new String[] { "-help", "-checkHealth" }, - "Usage: java RMAdmin [-checkHealth ]", dataErr, 0); + "Usage: yarn rmadmin [-checkHealth ]", dataErr, 0); testError(new String[] { "-help", "-failover" }, - "Usage: java RMAdmin " + + "Usage: yarn rmadmin " + "[-failover [--forcefence] [--forceactive] " + " ]", dataErr, 0); testError(new String[] { "-help", "-badParameter" }, - "Usage: java RMAdmin", dataErr, 0); + "Usage: yarn rmadmin", dataErr, 0); testError(new String[] { "-badParameter" }, "badParameter: Unknown command", dataErr, -1); } finally {