From 74480b3655a6ff27d542dff88565abe9c9bbb2c4 Mon Sep 17 00:00:00 2001
From: dugujiujiang <2563829168@qq.com>
Date: Wed, 8 Jan 2025 12:38:20 +0800
Subject: [PATCH] AMBARI-17314: Log Search Solr Client intsall failed due to
missing solrCloudCli.sh
---
.../src/main/package/deb/portal/postinst | 3 +++
.../main/package/rpm/portal/postinstall.sh | 3 +++
ambari-logsearch-server/build.xml | 4 +++
.../src/main/scripts/solrCloudCli.sh | 26 +++++++++++++++++++
4 files changed, 36 insertions(+)
create mode 100644 ambari-logsearch-server/src/main/scripts/solrCloudCli.sh
diff --git a/ambari-logsearch-assembly/src/main/package/deb/portal/postinst b/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
index e71445b41cd..8b722da5269 100644
--- a/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
+++ b/ambari-logsearch-assembly/src/main/package/deb/portal/postinst
@@ -16,11 +16,14 @@
LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
LOGSEARCH_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-portal/bin/logsearch.sh"
+LOGSEARCH_SOLR_CLIENT_SCRIPT_LINK_NAME="/usr/lib/ambari-logsearch-solr-client/bin/solrCloudCli.sh"
+LOGSEARCH_SOLR_CLIENT_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-portal/bin/solrCloudCli.sh"
LOGSEARCH_CONF_LINK="/etc/ambari-logsearch-portal/conf"
LOGSEARCH_CONF_SOURCE="/usr/lib/ambari-logsearch-portal/conf"
ln -s $LOGSEARCH_SCRIPT_SOURCE $LOGSEARCH_SCRIPT_LINK_NAME
+ln -s LOGSEARCH_SOLR_CLIENT_SCRIPT_SOURCE $LOGSEARCH_SOLR_CLIENT_SCRIPT_LINK_NAME
#ln -s $LOGSEARCH_CONF_SOURCE $LOGSEARCH_CONF_LINK
# handle old keys folder
diff --git a/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh b/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh
index 97523f4f10e..25dd4c2e484 100644
--- a/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh
+++ b/ambari-logsearch-assembly/src/main/package/rpm/portal/postinstall.sh
@@ -16,6 +16,8 @@
LOGSEARCH_SCRIPT_LINK_NAME="/usr/bin/logsearch"
LOGSEARCH_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-portal/bin/logsearch.sh"
+LOGSEARCH_SOLR_CLIENT_SCRIPT_LINK_NAME="/usr/lib/ambari-logsearch-solr-client/bin/solrCloudCli.sh"
+LOGSEARCH_SOLR_CLIENT_SCRIPT_SOURCE="/usr/lib/ambari-logsearch-portal/bin/solrCloudCli.sh"
LOGSEARCH_ETC_FOLDER="/etc/ambari-logsearch-portal"
LOGSEARCH_CONF_LINK="$LOGSEARCH_ETC_FOLDER/conf"
@@ -24,6 +26,7 @@ LOGSEARCH_CONF_SOURCE="/usr/lib/ambari-logsearch-portal/conf"
mkdir -p $LOGSEARCH_ETC_FOLDER
ln -s $LOGSEARCH_SCRIPT_SOURCE $LOGSEARCH_SCRIPT_LINK_NAME
+ln -s LOGSEARCH_SOLR_CLIENT_SCRIPT_SOURCE $LOGSEARCH_SOLR_CLIENT_SCRIPT_LINK_NAME
#ln -s $LOGSEARCH_CONF_SOURCE $LOGSEARCH_CONF_LINK
# handle old keys folder
diff --git a/ambari-logsearch-server/build.xml b/ambari-logsearch-server/build.xml
index 88ccd6b7fa5..890b045603c 100644
--- a/ambari-logsearch-server/build.xml
+++ b/ambari-logsearch-server/build.xml
@@ -56,8 +56,12 @@
+
+
+
+
diff --git a/ambari-logsearch-server/src/main/scripts/solrCloudCli.sh b/ambari-logsearch-server/src/main/scripts/solrCloudCli.sh
new file mode 100644
index 00000000000..69f9b2c0e4c
--- /dev/null
+++ b/ambari-logsearch-server/src/main/scripts/solrCloudCli.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+JVM="java"
+sdir="`dirname \"$0\"`"
+ldir="`dirname "$(readlink -f "$0")"`"
+
+DIR="$sdir"
+if [ "$sdir" != "$ldir" ]; then
+ DIR="$ldir"
+fi
+
+PATH=$JAVA_HOME/bin:$PATH $JVM -classpath "$DIR:$DIR/libs/*" $INFRA_SOLR_CLI_OPTS org.apache.ambari.infra.solr.AmbariSolrCloudCLI ${1+"$@"}
\ No newline at end of file