From 889924fee413c2a5116f4befc592139d7c28b939 Mon Sep 17 00:00:00 2001 From: phil Date: Sat, 13 May 2023 09:05:28 +0200 Subject: [PATCH] Update script --- templates/update-opensearch-plugins.j2 | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/templates/update-opensearch-plugins.j2 b/templates/update-opensearch-plugins.j2 index b00a65a..57df247 100644 --- a/templates/update-opensearch-plugins.j2 +++ b/templates/update-opensearch-plugins.j2 @@ -1,22 +1,24 @@ -#!/bin/sh +#!/bin/bash # {{ ansible_managed }} set -eu OPENSEARCH_BIN_PATH=/usr/share/opensearch/bin OPENSEARCH_SERVICE=opensearch.service -PLUGINS=( - ingest-attachment -) ACTION="${1:-help}" case "$ACTION" in purge) - for plugin in "${PLUGINS[@]}"; do - $OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin --batch - done - systemctl restart $OPENSEARCH_SERVICE + PLUGINS=$($OPENSEARCH_BIN_PATH/opensearch-plugin list | grep -v opensearch-) + if [[ -z "$PLUGINS" ]]; then + exit 0 + else + for plugin in "${PLUGINS[@]}"; do + $OPENSEARCH_BIN_PATH/opensearch-plugin remove $plugin + done + systemctl restart $OPENSEARCH_SERVICE + fi ;; install) for plugin in "${PLUGINS[@]}"; do