HDFS-5468. CacheAdmin help command does not recognize commands (Stephen Chu via Colin Patrick McCabe)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1539786 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Colin McCabe 2013-11-07 19:58:52 +00:00
parent 9964a94386
commit 77afc605fd
3 changed files with 20 additions and 3 deletions

View File

@ -354,6 +354,9 @@ Trunk (Unreleased)
HDFS-5419. Fixup test-patch.sh warnings on HDFS-4949 branch. (wang) 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 Release 2.3.0 - UNRELEASED
INCOMPATIBLE CHANGES INCOMPATIBLE CHANGES

View File

@ -261,13 +261,13 @@ public class CacheAdmin extends Configured implements Tool {
@Override @Override
public String getShortUsage() { public String getShortUsage() {
return "[" + getName() + " <path>]\n"; return "[" + getName() + " -path <path>]\n";
} }
@Override @Override
public String getLongUsage() { public String getLongUsage() {
TableListing listing = getOptionDescriptionListing(); 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 " + "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 " + "to remove it. To see a list of cache directives, use the " +
"-listDirectives command."); "-listDirectives command.");
@ -720,7 +720,6 @@ public class CacheAdmin extends Configured implements Tool {
return 0; return 0;
} }
String commandName = args.get(0); String commandName = args.get(0);
commandName = commandName.replaceAll("^[-]*", "");
Command command = determineCommand(commandName); Command command = determineCommand(commandName);
if (command == null) { if (command == null) {
System.err.print("Sorry, I don't know the command '" + System.err.print("Sorry, I don't know the command '" +

View File

@ -358,5 +358,20 @@
</comparators> </comparators>
</test> </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> </tests>
</configuration> </configuration>