From bfae12efd675f6b05e70f4d77d9ce59318b2c854 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sat, 28 Sep 2024 17:06:09 -0400 Subject: [PATCH 1/4] Simplify method calls, and forward port changes from PR#2710 --- solr/core/src/java/org/apache/solr/cli/AuthTool.java | 12 ++++++------ .../org/apache/solr/cli/ConfigSetDownloadTool.java | 2 +- .../org/apache/solr/cli/ConfigSetUploadTool.java | 2 +- .../src/java/org/apache/solr/cli/CreateTool.java | 12 +++++------- .../src/java/org/apache/solr/cli/DeleteTool.java | 9 ++++----- .../java/org/apache/solr/cli/HealthcheckTool.java | 2 +- .../src/java/org/apache/solr/cli/RunExampleTool.java | 5 ++--- solr/core/src/java/org/apache/solr/cli/ToolBase.java | 9 +++++++-- solr/core/src/java/org/apache/solr/cli/ZkCpTool.java | 6 +++--- solr/core/src/java/org/apache/solr/cli/ZkLsTool.java | 5 ++--- .../src/java/org/apache/solr/cli/ZkMkrootTool.java | 2 +- solr/core/src/java/org/apache/solr/cli/ZkMvTool.java | 2 +- solr/core/src/java/org/apache/solr/cli/ZkRmTool.java | 2 +- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/AuthTool.java b/solr/core/src/java/org/apache/solr/cli/AuthTool.java index ca3b45176c5..7a3f8651849 100644 --- a/solr/core/src/java/org/apache/solr/cli/AuthTool.java +++ b/solr/core/src/java/org/apache/solr/cli/AuthTool.java @@ -265,7 +265,7 @@ private int handleKerberos(CommandLine cli) throws Exception { if (!updateIncludeFileOnly) { if (!zkInaccessible) { - echoIfVerbose("Uploading following security.json: " + securityJson, cli); + echoIfVerbose("Uploading following security.json: " + securityJson); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { zkClient.setData( "/security.json", securityJson.getBytes(StandardCharsets.UTF_8), true); @@ -424,7 +424,7 @@ private int handleBasicAuth(CommandLine cli) throws Exception { String securityJson = securityJson1.toPrettyString(); if (!updateIncludeFileOnly) { - echoIfVerbose("Uploading following security.json: " + securityJson, cli); + echoIfVerbose("Uploading following security.json: " + securityJson); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { zkClient.setData("/security.json", securityJson.getBytes(StandardCharsets.UTF_8), true); } @@ -514,7 +514,7 @@ private void clearSecurityJson(CommandLine cli, boolean updateIncludeFileOnly) t SolrCLI.exit(1); } - echoIfVerbose("Uploading following security.json: {}", cli); + echoIfVerbose("Uploading following security.json: {}"); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { zkClient.setData("/security.json", "{}".getBytes(StandardCharsets.UTF_8), true); @@ -624,9 +624,9 @@ private void updateIncludeFileEnableAuth( Files.writeString(includeFile, lines, StandardCharsets.UTF_8); if (basicAuthConfFile != null) { - echoIfVerbose("Written out credentials file: " + basicAuthConfFile, cli); + echoIfVerbose("Written out credentials file: " + basicAuthConfFile); } - echoIfVerbose("Updated Solr include file: " + includeFile.toAbsolutePath(), cli); + echoIfVerbose("Updated Solr include file: " + includeFile.toAbsolutePath()); } private void updateIncludeFileDisableAuth(Path includeFile, CommandLine cli) throws IOException { @@ -648,7 +648,7 @@ private void updateIncludeFileDisableAuth(Path includeFile, CommandLine cli) thr if (hasChanged) { String lines = includeFileLines.stream().collect(Collectors.joining(System.lineSeparator())); Files.writeString(includeFile, lines, StandardCharsets.UTF_8); - echoIfVerbose("Commented out necessary lines from " + includeFile.toAbsolutePath(), cli); + echoIfVerbose("Commented out necessary lines from " + includeFile.toAbsolutePath()); } } diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java index d9322485dc7..13bc8c39377 100644 --- a/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetDownloadTool.java @@ -107,7 +107,7 @@ public void runImpl(CommandLine cli) throws Exception { String zkHost = SolrCLI.getZkHost(cli); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); String confName = cli.hasOption("conf-name") ? cli.getOptionValue("conf-name") diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java index 84faa2f2d2d..da98d373e97 100644 --- a/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ConfigSetUploadTool.java @@ -118,7 +118,7 @@ public void runImpl(CommandLine cli) throws Exception { String confDir = cli.hasOption("conf-dir") ? cli.getOptionValue("conf-dir") : cli.getOptionValue("confdir"); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); final Path configsetsDirPath = SolrCLI.getConfigSetsDir(solrInstallDirPath); Path confPath = ConfigSetService.getConfigsetPath(confDir, configsetsDirPath.toString()); diff --git a/solr/core/src/java/org/apache/solr/cli/CreateTool.java b/solr/core/src/java/org/apache/solr/cli/CreateTool.java index 222440afd11..c7d25c721aa 100644 --- a/solr/core/src/java/org/apache/solr/cli/CreateTool.java +++ b/solr/core/src/java/org/apache/solr/cli/CreateTool.java @@ -226,11 +226,10 @@ protected void createCore(CommandLine cli, SolrClient solrClient) throws Excepti echoIfVerbose( "\nCopying configuration to new core instance directory:\n" - + coreInstanceDir.toAbsolutePath(), - cli); + + coreInstanceDir.toAbsolutePath()); } - echoIfVerbose("\nCreating new core '" + coreName + "' using CoreAdminRequest", cli); + echoIfVerbose("\nCreating new core '" + coreName + "' using CoreAdminRequest"); try { CoreAdminResponse res = CoreAdminRequest.createCore(coreName, coreName, solrClient); @@ -257,7 +256,7 @@ protected void createCollection(CommandLine cli) throws Exception { cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt())); String zkHost = SolrCLI.getZkHost(cli); try (CloudSolrClient cloudSolrClient = SolrCLI.getCloudHttp2SolrClient(zkHost, builder)) { - echoIfVerbose("Connecting to ZooKeeper at " + zkHost, cli); + echoIfVerbose("Connecting to ZooKeeper at " + zkHost); cloudSolrClient.connect(); createCollection(cloudSolrClient, cli); } @@ -331,8 +330,7 @@ protected void createCollection(CloudSolrClient cloudSolrClient, CommandLine cli + " for config " + confName + " to ZooKeeper at " - + cloudSolrClient.getClusterStateProvider().getQuorumHosts(), - cli); + + cloudSolrClient.getClusterStateProvider().getQuorumHosts()); // We will trust the config since we have the Zookeeper Address configSetService.uploadConfig(confName, confPath, true); } @@ -348,7 +346,7 @@ protected void createCollection(CloudSolrClient cloudSolrClient, CommandLine cli // doesn't seem to exist ... try to create echoIfVerbose( - "\nCreating new collection '" + collectionName + "' using CollectionAdminRequest", cli); + "\nCreating new collection '" + collectionName + "' using CollectionAdminRequest"); NamedList response; try { diff --git a/solr/core/src/java/org/apache/solr/cli/DeleteTool.java b/solr/core/src/java/org/apache/solr/cli/DeleteTool.java index b45c4c485d0..ed5c0ebd8c1 100644 --- a/solr/core/src/java/org/apache/solr/cli/DeleteTool.java +++ b/solr/core/src/java/org/apache/solr/cli/DeleteTool.java @@ -149,7 +149,7 @@ protected void deleteCollection(CommandLine cli) throws Exception { String zkHost = SolrCLI.getZkHost(cli); try (CloudSolrClient cloudSolrClient = SolrCLI.getCloudHttp2SolrClient(zkHost, builder)) { - echoIfVerbose("Connecting to ZooKeeper at " + zkHost, cli); + echoIfVerbose("Connecting to ZooKeeper at " + zkHost); cloudSolrClient.connect(); deleteCollection(cloudSolrClient, cli); } @@ -215,8 +215,7 @@ protected void deleteCollection(CloudSolrClient cloudSolrClient, CommandLine cli } } - echoIfVerbose( - "\nDeleting collection '" + collectionName + "' using CollectionAdminRequest", cli); + echoIfVerbose("\nDeleting collection '" + collectionName + "' using CollectionAdminRequest"); NamedList response; try { @@ -272,8 +271,8 @@ protected void deleteCore(CommandLine cli, SolrClient solrClient) throws Excepti } if (response != null) { - echoIfVerbose((String) response.get("response"), cli); - echoIfVerbose("\n", cli); + echoIfVerbose((String) response.get("response")); + echoIfVerbose("\n"); } } } diff --git a/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java b/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java index 1cd06a7a523..12b1518f34b 100644 --- a/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java +++ b/solr/core/src/java/org/apache/solr/cli/HealthcheckTool.java @@ -95,7 +95,7 @@ public void runImpl(CommandLine cli) throws Exception { System.exit(1); } try (CloudHttp2SolrClient cloudSolrClient = SolrCLI.getCloudHttp2SolrClient(zkHost)) { - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); cloudSolrClient.connect(); runCloudTool(cloudSolrClient, cli); } diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java index 13154438aa2..a30edc2037d 100644 --- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java +++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java @@ -240,8 +240,7 @@ public void runImpl(CommandLine cli) throws Exception { + ",\nexampleDir=" + exampleDir.getAbsolutePath() + "\nscript=" - + script, - cli); + + script); String exampleType = cli.getOptionValue("example"); if ("cloud".equals(exampleType)) { @@ -497,7 +496,7 @@ protected void runCloudExample(CommandLine cli) throws Exception { } cloudPorts[n] = port; - echoIfVerbose("Using port " + port + " for node " + (n + 1), cli); + echoIfVerbose("Using port " + port + " for node " + (n + 1)); } } else { echo("Starting up " + numNodes + " Solr nodes for your example SolrCloud cluster.\n"); diff --git a/solr/core/src/java/org/apache/solr/cli/ToolBase.java b/solr/core/src/java/org/apache/solr/cli/ToolBase.java index 43a42f77d7b..715134a9fc4 100644 --- a/solr/core/src/java/org/apache/solr/cli/ToolBase.java +++ b/solr/core/src/java/org/apache/solr/cli/ToolBase.java @@ -33,8 +33,13 @@ protected ToolBase(PrintStream stdout) { this.stdout = stdout; } - protected void echoIfVerbose(final String msg, CommandLine cli) { - if (cli.hasOption(SolrCLI.OPTION_VERBOSE.getOpt())) { + /** Is this tool being run in a verbose mode? */ + protected boolean isVerbose() { + return verbose; + } + + protected void echoIfVerbose(final String msg) { + if (verbose) { echo(msg); } } diff --git a/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java b/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java index d7e52b7772b..44c0afa94b7 100644 --- a/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ZkCpTool.java @@ -128,7 +128,7 @@ public void runImpl(CommandLine cli) throws Exception { SolrCLI.raiseLogLevelUnlessVerbose(cli); String zkHost = SolrCLI.getZkHost(cli); - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); String src = cli.getArgs()[0]; String dst = cli.getArgs()[1]; boolean recurse = cli.hasOption("recurse"); @@ -166,7 +166,7 @@ public void runImpl(CommandLine cli) throws Exception { } if (solrHome != null) { - echoIfVerbose("Using SolrHome: " + solrHome, cli); + echoIfVerbose("Using SolrHome: " + solrHome); try { // Be aware that if you start Solr and pass in some variables via -D like // solr start -DminStateByteLenForCompression=0 -c, this logic will not @@ -199,7 +199,7 @@ public void runImpl(CommandLine cli) throws Exception { } } if (minStateByteLenForCompression > -1) { - echoIfVerbose("Compression of state.json has been enabled", cli); + echoIfVerbose("Compression of state.json has been enabled"); } try (SolrZkClient zkClient = new SolrZkClient.Builder() diff --git a/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java b/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java index 27907c691c7..0fa24b39945 100644 --- a/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ZkLsTool.java @@ -67,7 +67,7 @@ public void runImpl(CommandLine cli) throws Exception { String znode = cli.getArgs()[0]; try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); boolean recurse = cli.hasOption("recurse"); echoIfVerbose( @@ -76,8 +76,7 @@ public void runImpl(CommandLine cli) throws Exception { + " from ZooKeeper at " + zkHost + " recurse: " - + recurse, - cli); + + recurse); stdout.print(zkClient.listZnode(znode, recurse)); } catch (Exception e) { log.error("Could not complete ls operation for reason: ", e); diff --git a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java index 8fb343a4e65..23cbafe8929 100644 --- a/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ZkMkrootTool.java @@ -84,7 +84,7 @@ public void runImpl(CommandLine cli) throws Exception { boolean failOnExists = cli.hasOption("fail-on-exists"); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); echo("Creating ZooKeeper path " + znode + " on ZooKeeper at " + zkHost); zkClient.makePath(znode, failOnExists, true); diff --git a/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java b/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java index 65e2fdc511b..bf9a2203c2d 100644 --- a/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ZkMvTool.java @@ -83,7 +83,7 @@ public void runImpl(CommandLine cli) throws Exception { String zkHost = SolrCLI.getZkHost(cli); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); String src = cli.getArgs()[0]; String dst = cli.getArgs()[1]; diff --git a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java index fbedfc77868..1359566aaf8 100644 --- a/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ZkRmTool.java @@ -76,7 +76,7 @@ public void runImpl(CommandLine cli) throws Exception { if (znode.equals("/")) { throw new SolrServerException("You may not remove the root ZK node ('/')!"); } - echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ...", cli); + echoIfVerbose("\nConnecting to ZooKeeper at " + zkHost + " ..."); try (SolrZkClient zkClient = SolrCLI.getSolrZkClient(cli, zkHost)) { if (!recurse && zkClient.getChildren(znode, null, true).size() != 0) { throw new SolrServerException( From b8b86453fc0eb519c2ddf8d82ad9b88f98c5a154 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sat, 28 Sep 2024 17:13:16 -0400 Subject: [PATCH 2/4] Finish forward porting --- .../java/org/apache/solr/cli/CreateTool.java | 35 +++++++++---------- .../java/org/apache/solr/cli/DeleteTool.java | 7 ++-- .../src/java/org/apache/solr/cli/SolrCLI.java | 2 +- 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/CreateTool.java b/solr/core/src/java/org/apache/solr/cli/CreateTool.java index c7d25c721aa..7a8fbc31c8d 100644 --- a/solr/core/src/java/org/apache/solr/cli/CreateTool.java +++ b/solr/core/src/java/org/apache/solr/cli/CreateTool.java @@ -233,12 +233,12 @@ protected void createCore(CommandLine cli, SolrClient solrClient) throws Excepti try { CoreAdminResponse res = CoreAdminRequest.createCore(coreName, coreName, solrClient); - if (cli.hasOption(SolrCLI.OPTION_VERBOSE.getOpt())) { + if (isVerbose()) { echo(res.jsonStr()); echo("\n"); - } else { - echo(String.format(Locale.ROOT, "\nCreated new core '%s'", coreName)); } + echo(String.format(Locale.ROOT, "\nCreated new core '%s'", coreName)); + } catch (Exception e) { /* create-core failed, cleanup the copied configset before propagating the error. */ PathUtils.deleteDirectory(coreInstanceDir); @@ -255,8 +255,8 @@ protected void createCollection(CommandLine cli) throws Exception { .withOptionalBasicAuthCredentials( cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt())); String zkHost = SolrCLI.getZkHost(cli); + echoIfVerbose("Connecting to ZooKeeper at " + zkHost); try (CloudSolrClient cloudSolrClient = SolrCLI.getCloudHttp2SolrClient(zkHost, builder)) { - echoIfVerbose("Connecting to ZooKeeper at " + zkHost); cloudSolrClient.connect(); createCollection(cloudSolrClient, cli); } @@ -360,25 +360,24 @@ protected void createCollection(CloudSolrClient cloudSolrClient, CommandLine cli "Failed to create collection '" + collectionName + "' due to: " + sse.getMessage()); } - if (cli.hasOption(SolrCLI.OPTION_VERBOSE.getOpt())) { + if (isVerbose()) { // pretty-print the response to stdout CharArr arr = new CharArr(); new JSONWriter(arr, 2).write(response.asMap()); echo(arr.toString()); - } else { - String endMessage = - String.format( - Locale.ROOT, - "Created collection '%s' with %d shard(s), %d replica(s)", - collectionName, - numShards, - replicationFactor); - if (confName != null && !confName.trim().isEmpty()) { - endMessage += String.format(Locale.ROOT, " with config-set '%s'", confName); - } - - echo(endMessage); } + String endMessage = + String.format( + Locale.ROOT, + "Created collection '%s' with %d shard(s), %d replica(s)", + collectionName, + numShards, + replicationFactor); + if (confName != null && !confName.trim().isEmpty()) { + endMessage += String.format(Locale.ROOT, " with config-set '%s'", confName); + } + + echo(endMessage); } private Path getFullConfDir(Path solrInstallDir, Path confDirName) { diff --git a/solr/core/src/java/org/apache/solr/cli/DeleteTool.java b/solr/core/src/java/org/apache/solr/cli/DeleteTool.java index ed5c0ebd8c1..5001febad77 100644 --- a/solr/core/src/java/org/apache/solr/cli/DeleteTool.java +++ b/solr/core/src/java/org/apache/solr/cli/DeleteTool.java @@ -21,6 +21,7 @@ import java.io.PrintStream; import java.lang.invoke.MethodHandles; import java.util.List; +import java.util.Locale; import java.util.Optional; import java.util.Set; import java.util.concurrent.TimeUnit; @@ -237,11 +238,11 @@ protected void deleteCollection(CloudSolrClient cloudSolrClient, CommandLine cli + configZnode + " in ZooKeeper due to: " + exc.getMessage() - + "\nYou'll need to manually delete this znode using the zkcli script."); + + "\nYou'll need to manually delete this znode using the bin/solr zk rm command."); } } - if (response != null) { + if (isVerbose() && response != null) { // pretty-print the response to stdout CharArr arr = new CharArr(); new JSONWriter(arr, 2).write(response.asMap()); @@ -249,7 +250,7 @@ protected void deleteCollection(CloudSolrClient cloudSolrClient, CommandLine cli echo("\n"); } - echo("Deleted collection '" + collectionName + "' using CollectionAdminRequest"); + echo(String.format(Locale.ROOT, "\nDeleted collection '%s'", collectionName)); } protected void deleteCore(CommandLine cli, SolrClient solrClient) throws Exception { diff --git a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java index dc4045ef90d..f0495dd7ae5 100755 --- a/solr/core/src/java/org/apache/solr/cli/SolrCLI.java +++ b/solr/core/src/java/org/apache/solr/cli/SolrCLI.java @@ -222,7 +222,7 @@ public static void main(String[] args) throws Exception { args = remappedArgs; } } else { - // chop the leading zk argument so we invoke the correct zk sub tool + // chop the leading zk argument, so we invoke the correct zk sub tool String[] trimmedArgs = new String[args.length - 1]; System.arraycopy(args, 1, trimmedArgs, 0, trimmedArgs.length); args = trimmedArgs; From 083de1719c97f2866827488148bf71029cd3ac0e Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sat, 28 Sep 2024 17:53:48 -0400 Subject: [PATCH 3/4] simplify method --- .../src/java/org/apache/solr/cli/RunExampleTool.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java index 747fae73c65..2bd668d5ee2 100644 --- a/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java +++ b/solr/core/src/java/org/apache/solr/cli/RunExampleTool.java @@ -707,7 +707,7 @@ protected Map startSolr( if (code != 0) throw new Exception("Failed to start Solr using command: " + startCmd); return getNodeStatus( - solrUrl, cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()), maxWaitSecs, cli); + solrUrl, cli.getOptionValue(SolrCLI.OPTION_CREDENTIALS.getLongOpt()), maxWaitSecs); } protected Map checkPortConflict( @@ -886,10 +886,10 @@ protected boolean isValidConfig(File configsetsDir, String config) { return configDir.isDirectory(); } - protected Map getNodeStatus( - String solrUrl, String credentials, int maxWaitSecs, CommandLine cli) throws Exception { + protected Map getNodeStatus(String solrUrl, String credentials, int maxWaitSecs) + throws Exception { StatusTool statusTool = new StatusTool(); - echoIfVerbose("\nChecking status of Solr at " + solrUrl + " ...", cli); + echoIfVerbose("\nChecking status of Solr at " + solrUrl + " ..."); URI solrURI = new URI(solrUrl); Map nodeStatus = @@ -900,8 +900,7 @@ protected Map getNodeStatus( String mode = (nodeStatus.get("cloud") != null) ? "cloud" : "standalone"; echoIfVerbose( - "\nSolr is running on " + solrURI.getPort() + " in " + mode + " mode with status:\n" + arr, - cli); + "\nSolr is running on " + solrURI.getPort() + " in " + mode + " mode with status:\n" + arr); return nodeStatus; } From 94f34aee7633db809b588bb5b5f0756e1bfa48ef Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 29 Sep 2024 06:53:03 -0400 Subject: [PATCH 4/4] Fix method signature and improve tests --- solr/core/src/java/org/apache/solr/cli/ConfigTool.java | 8 +++++--- solr/packaging/test/test_config.bats | 6 ++++++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java b/solr/core/src/java/org/apache/solr/cli/ConfigTool.java index 51d7b114de0..1ffdb5a401f 100644 --- a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ConfigTool.java @@ -107,7 +107,7 @@ public List