Skip to content

Commit

Permalink
KNOX-3071: Added the cluster string separator as a constant and chang…
Browse files Browse the repository at this point in the history
…ed it to comma
  • Loading branch information
hanicz committed Oct 21, 2024
1 parent bd2b812 commit 8716de8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public class KnoxCLI extends Configured implements Tool {
" [" + GenerateDescriptorCommand.USAGE + "]\n" +
" [" + TokenMigration.USAGE + "]\n" +
" [" + CreateListAliasesCreateCommand.USAGE + "]\n";
private static final String CLUSTER_STRING_SEPARATOR = ",";

/** allows stdout to be captured if necessary */
public PrintStream out = System.out;
Expand Down Expand Up @@ -717,7 +718,7 @@ protected RemoteConfigurationRegistryClientService getRemoteConfigRegistryClient

private class AliasListCommand extends Command {

public static final String USAGE = "list-alias [--cluster cluster1:clusterN]";
public static final String USAGE = "list-alias [--cluster cluster1,clusterN]";
public static final String DESC = "The list-alias command lists all of the aliases\n" +
"for the given hadoop --cluster(s). The default\n" +
"--cluster being the gateway itself.";
Expand All @@ -730,7 +731,7 @@ public void execute() throws Exception {
if (cluster == null) {
cluster = "__gateway";
}
String[] clusters = cluster.split(":");
String[] clusters = cluster.split(CLUSTER_STRING_SEPARATOR);
for (String currentCluster : clusters) {
boolean credentialStoreForClusterAvailable =
keystoreService.isCredentialStoreForClusterAvailable(currentCluster);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ public void testListingAliasesForMultipleClusters() throws Exception {
"created."));

outContent.reset();
String[] args3 = { "list-alias", "--cluster", "cluster1:test", "--master", "master" };
String[] args3 = { "list-alias", "--cluster", "cluster1,test", "--master", "master" };
rc = cli.run(args3);
assertEquals(0, rc);
assertTrue(outContent.toString(StandardCharsets.UTF_8.name()),
Expand All @@ -1341,7 +1341,7 @@ public void testListingAliasesForMultipleClusters() throws Exception {
outContent.toString(StandardCharsets.UTF_8.name()).contains("multiplealias2"));

outContent.reset();
String[] args4 = { "list-alias", "--cluster", "cluster1:test:invalidcluster", "--master", "master" };
String[] args4 = { "list-alias", "--cluster", "cluster1,test,invalidcluster", "--master", "master" };
rc = cli.run(args4);
assertEquals(0, rc);
assertTrue(outContent.toString(StandardCharsets.UTF_8.name()),
Expand Down

0 comments on commit 8716de8

Please sign in to comment.