Remove plugin only if exists
This commit is contained in:
parent
982522ca8e
commit
ebeb090ef8
1 changed files with 4 additions and 1 deletions
|
@ -4,6 +4,7 @@
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin
|
OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin
|
||||||
|
OPENSEARCH_PLUGIN_PATH=/usr/share/opensearch/plugins
|
||||||
OPENSEARCH_SERVICE=opensearch.service
|
OPENSEARCH_SERVICE=opensearch.service
|
||||||
PLUGINS=(
|
PLUGINS=(
|
||||||
{% for plugin in opensearch_plugins %}
|
{% for plugin in opensearch_plugins %}
|
||||||
|
@ -19,7 +20,9 @@ ACTION="${1:-help}"
|
||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
purge)
|
purge)
|
||||||
for plugin in "${PLUGINS[@]}"; do
|
for plugin in "${PLUGINS[@]}"; do
|
||||||
|
if [ -d "$OPENSEARCH_PLUGIN_PATH/$plugin" ]; then
|
||||||
$OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin
|
$OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
systemctl restart $OPENSEARCH_SERVICE
|
systemctl restart $OPENSEARCH_SERVICE
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in a new issue