Author: cmccabe Date: Thu Nov 7 19:58:52 2013 New Revision: 1539786 URL: http://svn.apache.org/r1539786 Log: HDFS-5468. CacheAdmin help command does not recognize commands (Stephen Chu via Colin Patrick McCabe)
Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1539786&r1=1539785&r2=1539786&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Nov 7 19:58:52 2013 @@ -354,6 +354,9 @@ Trunk (Unreleased) HDFS-5419. Fixup test-patch.sh warnings on HDFS-4949 branch. (wang) + HDFS-5468. CacheAdmin help command does not recognize commands (Stephen + Chu via Colin Patrick McCabe) + Release 2.3.0 - UNRELEASED INCOMPATIBLE CHANGES Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java?rev=1539786&r1=1539785&r2=1539786&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/tools/CacheAdmin.java Thu Nov 7 19:58:52 2013 @@ -261,13 +261,13 @@ public class CacheAdmin extends Configur @Override public String getShortUsage() { - return "[" + getName() + " <path>]\n"; + return "[" + getName() + " -path <path>]\n"; } @Override public String getLongUsage() { TableListing listing = getOptionDescriptionListing(); - listing.addRow("<path>", "The path of the cache directives to remove. " + + listing.addRow("-path <path>", "The path of the cache directives to remove. " + "You must have write permission on the pool of the directive in order " + "to remove it. To see a list of cache directives, use the " + "-listDirectives command."); @@ -720,7 +720,6 @@ public class CacheAdmin extends Configur return 0; } String commandName = args.get(0); - commandName = commandName.replaceAll("^[-]*", ""); Command command = determineCommand(commandName); if (command == null) { System.err.print("Sorry, I don't know the command '" + Modified: hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml?rev=1539786&r1=1539785&r2=1539786&view=diff ============================================================================== --- hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml (original) +++ hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testCacheAdminConf.xml Thu Nov 7 19:58:52 2013 @@ -358,5 +358,20 @@ </comparators> </test> + <test> + <description>Testing the help usage</description> + <test-commands> + <cache-admin-command>-help -addPool</cache-admin-command> + </test-commands> + <cleanup-commands> + </cleanup-commands> + <comparators> + <comparator> + <type>SubstringComparator</type> + <expected-output>Add a new cache pool.</expected-output> + </comparator> + </comparators> + </test> + </tests> </configuration>