From ebeb090ef8e649582af591e6fd425b3d92cd2716 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 23 Oct 2023 12:27:35 +0200 Subject: [PATCH] Remove plugin only if exists --- templates/update-opensearch-plugins.j2 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/templates/update-opensearch-plugins.j2 b/templates/update-opensearch-plugins.j2 index 3a0b7ac..d762a5f 100644 --- a/templates/update-opensearch-plugins.j2 +++ b/templates/update-opensearch-plugins.j2 @@ -4,6 +4,7 @@ set -eu OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin +OPENSEARCH_PLUGIN_PATH=/usr/share/opensearch/plugins OPENSEARCH_SERVICE=opensearch.service PLUGINS=( {% for plugin in opensearch_plugins %} @@ -19,7 +20,9 @@ ACTION="${1:-help}" case "$ACTION" in purge) for plugin in "${PLUGINS[@]}"; do - $OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin + if [ -d "$OPENSEARCH_PLUGIN_PATH/$plugin" ]; then + $OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin + fi done systemctl restart $OPENSEARCH_SERVICE ;;