From c5b518a493c866c5a5a3ca2c21ade04c3db165b9 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Thu, 16 Jan 2020 09:00:08 +0100 Subject: [PATCH 1/2] Enhancing the Solr schema update script. See #6529 --- conf/solr/7.3.1/updateSchemaMDB.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/conf/solr/7.3.1/updateSchemaMDB.sh b/conf/solr/7.3.1/updateSchemaMDB.sh index e4446083442..a760f3d2a36 100755 --- a/conf/solr/7.3.1/updateSchemaMDB.sh +++ b/conf/solr/7.3.1/updateSchemaMDB.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -euo pipefail # This script updates the and schema configuration necessary to properly @@ -61,6 +61,12 @@ echo "Retrieve schema data from ${DATAVERSE_URL}/api/admin/index/solr/schema" TMPFILE=`mktemp` curl -f -sS "${DATAVERSE_URL}/api/admin/index/solr/schema${UNBLOCK_KEY}" > $TMPFILE +### Fail gracefull if Dataverse is not ready yet. +if [[ "`wc -l ${TMPFILE}`" < "3" ]]; then + echo "Dataverse responded with empty file. Did you bootstrap yet?" + exit 123 +fi + ### Processing echo "Writing ${TARGET}/schema_dv_mdb_fields.xml" echo "" > ${TARGET}/schema_dv_mdb_fields.xml @@ -76,4 +82,4 @@ rm ${TMPFILE}* ### Reloading echo "Triggering Solr RELOAD at ${SOLR_URL}/solr/admin/cores?action=RELOAD&core=collection1" -curl -f -sS "${SOLR_URL}/solr/admin/cores?action=RELOAD&core=collection1" \ No newline at end of file +curl -f -sS "${SOLR_URL}/solr/admin/cores?action=RELOAD&core=collection1" From c29c461fe3bd84f6293f01b8a5230a9b9c0a9038 Mon Sep 17 00:00:00 2001 From: Oliver Bertuch Date: Thu, 16 Jan 2020 13:28:45 +0100 Subject: [PATCH 2/2] Change log message to be more precise. #6529 --- conf/solr/7.3.1/updateSchemaMDB.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/solr/7.3.1/updateSchemaMDB.sh b/conf/solr/7.3.1/updateSchemaMDB.sh index a760f3d2a36..0044f15c7cd 100755 --- a/conf/solr/7.3.1/updateSchemaMDB.sh +++ b/conf/solr/7.3.1/updateSchemaMDB.sh @@ -63,7 +63,7 @@ curl -f -sS "${DATAVERSE_URL}/api/admin/index/solr/schema${UNBLOCK_KEY}" > $TMPF ### Fail gracefull if Dataverse is not ready yet. if [[ "`wc -l ${TMPFILE}`" < "3" ]]; then - echo "Dataverse responded with empty file. Did you bootstrap yet?" + echo "Dataverse responded with empty file. When running on K8s: did you bootstrap yet?" exit 123 fi