Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-7832: bin/post now allows either -url or -c, rather than requiring both

Erik Hatcher4f065ce7775a
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 18da1bceb50..2fd44cf4966 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -403,6 +403,8 @@ Other Changes
* SOLR-7863: Lowercase the CLUSTERPROP command in ZkCLI for consistency, print error for unknown cmd (janhoy)
+* SOLR-7832: bin/post now allows either -url or -c, rather than requiring both. (ehatcher)
+
================== 5.2.1 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release
diff --git a/solr/bin/post b/solr/bin/post
index d0a39e13033..39b2431c656 100755
--- a/solr/bin/post
+++ b/solr/bin/post
@@ -135,7 +135,7 @@ while [ $# -gt 0 ]; do
shift
COLLECTION="$1"
elif [[ "$1" == "-p" ]]; then
- # -p => -port for convenience and compatability with bin/solr start
+ # -p alias for -port for convenience and compatibility with `bin/solr start`
shift
PROPS+=("-Dport=$1")
elif [[ ("$1" == "-d" || "$1" == "--data" || "$1" == "-") ]]; then
@@ -156,6 +156,9 @@ while [ $# -gt 0 ]; do
shift
# echo "$1: PROP"
PROPS+=("-D$key=$1")
+ if [[ "$key" == "url" ]]; then
+ SOLR_URL=$1
+ fi
fi
else
echo -e "\nUnrecognized argument: $1\n"
@@ -167,8 +170,8 @@ while [ $# -gt 0 ]; do
done
# Check for errors
-if [[ $COLLECTION == "" ]]; then
- echo -e "\nCollection must be specified. Use -c <collection name> or set DEFAULT_SOLR_COLLECTION in your environment.\n"
+if [[ $COLLECTION == "" && $SOLR_URL == "" ]]; then
+ echo -e "\nCollection or URL must be specified. Use -c <collection name> or set DEFAULT_SOLR_COLLECTION in your environment, or use -url instead.\n"
echo -e "See '$THIS_SCRIPT -h' for usage instructions.\n"
exit 1
fi