[
https://issues.apache.org/jira/browse/KNOX-3071?focusedWorklogId=938932&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-938932
]
ASF GitHub Bot logged work on KNOX-3071:
----------------------------------------
Author: ASF GitHub Bot
Created on: 18/Oct/24 15:15
Start Date: 18/Oct/24 15:15
Worklog Time Spent: 10m
Work Description: moresandeep commented on code in PR #940:
URL: https://github.com/apache/knox/pull/940#discussion_r1806663703
##########
gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java:
##########
@@ -136,7 +136,8 @@ public class KnoxCLI extends Configured implements Tool {
" [" + TopologyConverter.USAGE + "]\n" +
" [" + JWKGenerator.USAGE + "]\n" +
" [" + GenerateDescriptorCommand.USAGE + "]\n" +
- " [" + TokenMigration.USAGE + "]\n";
+ " [" + TokenMigration.USAGE + "]\n" +
+ " [" + CreateListAliasesCreateCommand.USAGE + "]\n";
Review Comment:
Great catch!
##########
gateway-server/src/main/java/org/apache/knox/gateway/util/KnoxCLI.java:
##########
@@ -701,31 +717,34 @@ protected RemoteConfigurationRegistryClientService
getRemoteConfigRegistryClient
private class AliasListCommand extends Command {
- public static final String USAGE = "list-alias [--cluster clustername]";
+ 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. The
default\n" +
+ "for the given hadoop --cluster(s). The
default\n" +
"--cluster being the gateway itself.";
@Override
public void execute() throws Exception {
AliasService as = getAliasService();
- KeystoreService keystoreService = getKeystoreService();
+ KeystoreService keystoreService = getKeystoreService();
if (cluster == null) {
cluster = "__gateway";
}
- boolean credentialStoreForClusterAvailable =
- keystoreService.isCredentialStoreForClusterAvailable(cluster);
- if (credentialStoreForClusterAvailable) {
- out.println("Listing aliases for: " + cluster);
- List<String> aliases = as.getAliasesForCluster(cluster);
- for (String alias : aliases) {
- out.println(alias);
- }
- out.println("\n" + aliases.size() + " items.");
- } else {
- out.println("Invalid cluster name provided: " + cluster);
- }
+ String[] clusters = cluster.split(":");
Review Comment:
1. `:` should be a constant e.g. CLUSTER_STRING_SEPARATOR
2. I think `,` would be more obvious, no?
3. What if the cluster had `:` it should not but we had a case where alias
name had special characters.
Issue Time Tracking
-------------------
Worklog Id: (was: 938932)
Time Spent: 20m (was: 10m)
> Batch list-alias and new create-list-aliases KnoxCLI commands
> -------------------------------------------------------------
>
> Key: KNOX-3071
> URL: https://issues.apache.org/jira/browse/KNOX-3071
> Project: Apache Knox
> Issue Type: New Feature
> Components: KnoxCLI
> Affects Versions: 2.1.0
> Reporter: Tamás Hanicz
> Priority: Minor
> Time Spent: 20m
> Remaining Estimate: 0h
>
> New feature for list-alias KnoxCLI command. The user should be able to
> provide multiple clusters concatenated by ':' and list the aliases for all of
> them.
> list-alias --cluster cluster1:cluster2:clusterN
> New create-list-aliases command that creates aliases on multiple clusters and
> list them at the end.
> create-list-aliases --alias alias1 --value value1 --cluster cluster1 --alias
> alias2 --value value2 --cluster2 --alias aliasN --value valueN --cluster
> clusterN
> When there is a --cluster args every alias before it will be added to that
> cluster.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)