From 2f0fe1fc64e0216ccfac62a4ff0621b7deb2fe18 Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sun, 29 Sep 2024 08:21:46 -0400 Subject: [PATCH] Forward port PR#2710 (#2726) * Simplify method calls, and forward port changes from PR#2710 --- .../java/org/apache/solr/cli/AuthTool.java | 12 ++--- .../solr/cli/ConfigSetDownloadTool.java | 2 +- .../apache/solr/cli/ConfigSetUploadTool.java | 2 +- .../java/org/apache/solr/cli/ConfigTool.java | 8 ++-- .../java/org/apache/solr/cli/CreateTool.java | 45 +++++++++---------- .../java/org/apache/solr/cli/DeleteTool.java | 16 +++---- .../org/apache/solr/cli/HealthcheckTool.java | 2 +- .../org/apache/solr/cli/RunExampleTool.java | 16 +++---- .../java/org/apache/solr/cli/ToolBase.java | 9 +++- .../java/org/apache/solr/cli/ZkCpTool.java | 6 +-- .../java/org/apache/solr/cli/ZkLsTool.java | 5 +-- .../org/apache/solr/cli/ZkMkrootTool.java | 2 +- .../java/org/apache/solr/cli/ZkMvTool.java | 2 +- .../java/org/apache/solr/cli/ZkRmTool.java | 2 +- solr/packaging/test/test_config.bats | 6 +++ 15 files changed, 71 insertions(+), 64 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/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