diff --git a/conf/solr/7.3.1/updateSchemaMDB.sh b/conf/solr/7.3.1/updateSchemaMDB.sh index e4446083442..0044f15c7cd 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. When running on K8s: 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"