From 7d7db740b24d483f736194f919147863141dc280 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Sat, 13 Jan 2024 13:37:54 -0500 Subject: [PATCH] Updates version selection logic Signed-off-by: Darshit Chanpura --- .../personalized_search_ranking_quickstart.sh | 16 ++++++---------- helpers/search_processing_kendra_quickstart.sh | 15 ++++++--------- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/helpers/personalized_search_ranking_quickstart.sh b/helpers/personalized_search_ranking_quickstart.sh index 1f44c11..ee5c9a3 100755 --- a/helpers/personalized_search_ranking_quickstart.sh +++ b/helpers/personalized_search_ranking_quickstart.sh @@ -253,17 +253,13 @@ if [ -n "${VOLUME_NAME:-}" ]; then fi echo "Volume created" - # Starting in 2.12.0, security demo configuration script requires an initial admin password -IFS='.' read -ra version_array <<< "$VERSION" - -if [ -z "$CREDENTIAL" ] -then - if (( ${version_array[0]} > 2 || (${version_array[0]} == 2 && ${version_array[1]} >= 12) )); then - CREDENTIAL="admin:myStrongPassword123!" - else - CREDENTIAL="admin:admin" - fi +OPENSEARCH_REQUIRED_VERSION="2.12.0" +COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` +if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then + OPENSEARCH_INITIAL_ADMIN_PASSWORD="admin" +else + OPENSEARCH_INITIAL_ADMIN_PASSWORD="myStrongPassword123!" fi # diff --git a/helpers/search_processing_kendra_quickstart.sh b/helpers/search_processing_kendra_quickstart.sh index be3cce7..ba62405 100755 --- a/helpers/search_processing_kendra_quickstart.sh +++ b/helpers/search_processing_kendra_quickstart.sh @@ -360,15 +360,12 @@ if [ -n "${VOLUME_NAME:-}" ]; then fi # Starting in 2.12.0, security demo configuration script requires an initial admin password -IFS='.' read -ra version_array <<< "$VERSION" - -if [ -z "$CREDENTIAL" ] -then - if (( ${version_array[0]} > 2 || (${version_array[0]} == 2 && ${version_array[1]} >= 12) )); then - CREDENTIAL="admin:myStrongPassword123!" - else - CREDENTIAL="admin:admin" - fi +OPENSEARCH_REQUIRED_VERSION="2.12.0" +COMPARE_VERSION=`echo $OPENSEARCH_REQUIRED_VERSION $OPENSEARCH_VERSION | tr ' ' '\n' | sort -V | uniq | head -n 1` +if [ "$COMPARE_VERSION" != "$OPENSEARCH_REQUIRED_VERSION" ]; then + OPENSEARCH_INITIAL_ADMIN_PASSWORD="admin" +else + OPENSEARCH_INITIAL_ADMIN_PASSWORD="myStrongPassword123!" fi