From eda5ec35e6ca7d4102a09c7e14b89ae3580c4cdd Mon Sep 17 00:00:00 2001 From: Eric Pugh Date: Sat, 28 Sep 2024 17:30:58 -0400 Subject: [PATCH] SOLR-17442: Resolve -v flag conflict (version, value, verbose) (#2721) Deprecate the various uses of -v, so that we don't have conflicts there. --------- Signed-off-by: Eric Pugh --- solr/CHANGES.txt | 2 + solr/bin/solr | 17 +++----- solr/bin/solr.cmd | 17 +++----- .../java/org/apache/solr/cli/ConfigTool.java | 22 ++++++++-- .../java/org/apache/solr/cli/CreateTool.java | 4 +- .../org/apache/solr/cli/RunExampleTool.java | 20 ++++----- .../apache/solr/cli/SnapshotCreateTool.java | 3 +- .../apache/solr/cli/SnapshotDeleteTool.java | 3 +- .../apache/solr/cli/SnapshotDescribeTool.java | 3 +- .../apache/solr/cli/SnapshotExportTool.java | 3 +- .../org/apache/solr/cli/SnapshotListTool.java | 3 +- .../src/java/org/apache/solr/cli/SolrCLI.java | 36 ++++++++++++---- .../java/org/apache/solr/cli/ZkLsTool.java | 3 +- .../org/apache/solr/cli/ZkMkrootTool.java | 3 +- .../java/org/apache/solr/cli/ZkMvTool.java | 3 +- .../java/org/apache/solr/cli/ZkRmTool.java | 3 +- solr/packaging/test/test_bats.bats | 2 +- solr/packaging/test/test_config.bats | 1 + solr/packaging/test/test_help.bats | 6 --- solr/packaging/test/test_version.bats | 42 +++++++++++++++++++ solr/packaging/test/test_zk.bats | 2 +- .../pages/configuring-logging.adoc | 6 +-- .../pages/solr-control-script-reference.adoc | 31 ++++---------- 23 files changed, 136 insertions(+), 99 deletions(-) create mode 100644 solr/packaging/test/test_version.bats diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt index bac9c16ec23..bd9cf256425 100644 --- a/solr/CHANGES.txt +++ b/solr/CHANGES.txt @@ -123,6 +123,8 @@ Improvements * SOLR-17431: Deprecate -p parameter where it doesn't refer to a port in bin/solr. (Eric Pugh, Christos Malliaridis) +* SOLR-17442: Resolve -v flag conflict (version, value, verbose) in bin/solr. (Eric Pugh, Christos Malliaridis) + Optimizations --------------------- * SOLR-14985: Solrj CloudSolrClient with Solr URLs had serious performance regressions (since the diff --git a/solr/bin/solr b/solr/bin/solr index d02d2c6545f..040192548d8 100755 --- a/solr/bin/solr +++ b/solr/bin/solr @@ -425,13 +425,11 @@ function print_usage() { echo " --force If attempting to start Solr as the root user, the script will exit with a warning that running Solr as \"root\" can cause problems." echo " It is possible to override this warning with the '--force' parameter." echo "" - echo " -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level of Solr to DEBUG or WARN instead of INFO" - echo "" - echo " -V/--verbose Verbose messages from this script" + echo " --verbose or --quiet/-q Verbose or quiet logging. Sets default log level of Solr to DEBUG or WARN instead of INFO" echo "" elif [ "$CMD" == "stop" ]; then echo "" - echo "Usage: solr stop [-k key] [-p port] [-V]" + echo "Usage: solr stop [-k key] [-p port] [--all]" echo "" echo " -k Stop key; default is solrrocks" echo "" @@ -439,7 +437,7 @@ function print_usage() { echo "" echo " --all Find and stop all running Solr servers on this host" echo "" - echo " -V/--verbose Verbose messages from this script" + echo " --verbose Verbose messages from this script" echo "" echo " NOTE: To see if any Solr servers are running, do: solr status" echo "" @@ -861,16 +859,13 @@ if [ $# -gt 0 ]; then PASS_TO_RUN_EXAMPLE+=("--no-prompt") shift ;; - -V|--verbose|-verbose) + -V|--verbose|-verbose|-v) verbose=true - PASS_TO_RUN_EXAMPLE+=("--verbose") - shift - ;; - -v) SOLR_LOG_LEVEL=DEBUG + PASS_TO_RUN_EXAMPLE+=("--verbose") shift ;; - -q) + -q|--quiet) SOLR_LOG_LEVEL=WARN shift ;; diff --git a/solr/bin/solr.cmd b/solr/bin/solr.cmd index 287daec0834..ae51b74d8cf 100755 --- a/solr/bin/solr.cmd +++ b/solr/bin/solr.cmd @@ -362,15 +362,13 @@ goto done @echo. @echo --no-prompt Don't prompt for input; accept all defaults when running examples that accept user input @echo. -@echo -v and -q Verbose (-v) or quiet (-q) logging. Sets default log level to DEBUG or WARN instead of INFO -@echo. -@echo -V/--verbose Verbose messages from this script +@echo --verbose and -q/--quiet Verbose or quiet logging. Sets default log level to DEBUG or WARN instead of INFO @echo. goto done :stop_usage @echo. -@echo Usage: solr stop [-k key] [-p port] [-V] +@echo Usage: solr stop [-k key] [-p port] [--verbose] @echo. @echo -k key Stop key; default is solrrocks @echo. @@ -378,7 +376,7 @@ goto done @echo. @echo --all Find and stop all running Solr servers on this host @echo. -@echo -V/--verbose Verbose messages from this script +@echo --verbose Verbose messages from this script @echo. @echo NOTE: To see if any Solr servers are running, do: solr status @echo. @@ -400,8 +398,9 @@ IF "%1"=="-f" goto set_foreground_mode IF "%1"=="--foreground" goto set_foreground_mode IF "%1"=="-V" goto set_verbose IF "%1"=="--verbose" goto set_verbose -IF "%1"=="-v" goto set_debug +IF "%1"=="-v" goto set_verbose IF "%1"=="-q" goto set_warn +IF "%1"=="--quiet" goto set_warn IF "%1"=="-c" goto set_cloud_mode IF "%1"=="-cloud" goto set_cloud_mode IF "%1"=="--cloud" goto set_cloud_mode @@ -451,12 +450,8 @@ goto parse_args :set_verbose set verbose=1 -set "PASS_TO_RUN_EXAMPLE=--verbose !PASS_TO_RUN_EXAMPLE!" -SHIFT -goto parse_args - -:set_debug set SOLR_LOG_LEVEL=DEBUG +set "PASS_TO_RUN_EXAMPLE=--verbose !PASS_TO_RUN_EXAMPLE!" SHIFT goto parse_args 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 bc2a8b7dbc0..51d7b114de0 100644 --- a/solr/core/src/java/org/apache/solr/cli/ConfigTool.java +++ b/solr/core/src/java/org/apache/solr/cli/ConfigTool.java @@ -92,12 +92,24 @@ public List