Skip to content
This repository has been archived by the owner on Jul 27, 2022. It is now read-only.

Commit

Permalink
ISAICP-6567: Check that --snapshot dir is an absolute path.
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiu-cristea committed Jul 6, 2021
1 parent 05cb20c commit 58e37b4
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions scripts/solr/restore_solr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,13 @@ if ! [[ $TIMEOUT =~ ${TIMEOUT_PATTERN} ]] ; then
error "Timeout needs to be numeric!";
fi

if [ "${CORE}" == '' ] || [ "${SNAPSHOT_NAME}" == '' ]; then
if [ "${CORE}" == '' ] || [ "${SNAPSHOT_DIR}" == '' ] || [ "${SNAPSHOT_NAME}" == '' ]; then
show_help;
exit 1;
fi

# Assume the current dir if no snapshot dir has been passed.
if [ "${SNAPSHOT_DIR}" == '' ]; then
SNAPSHOT_DIR=${CURRENT_DIR}
fi

if [ ! -d "${SNAPSHOT_DIR}" ]; then
error "The '${SNAPSHOT_DIR}' directory doesn't exist!";
fi

# Normalize the snapshot dir to an absolute path.
cd ${SNAPSHOT_DIR}
SNAPSHOT_DIR=$(pwd)
cd ${CURRENT_DIR}

if [ ! -d "${SNAPSHOT_DIR}/snapshot.${SNAPSHOT_NAME}" ]; then
error "The '${SNAPSHOT_DIR}' directory doesn't contain a '${SNAPSHOT_NAME}' snapshot!";
if [ ! -z "${SNAPSHOT_DIR%%/*}" ] || ! pathchk -p "${SNAPSHOT_DIR}"; then
error "The --snapshot-dir path should be absolute!"
fi

CORE_EXISTS=`curl -sS "${SOLR_SERVER_URL}/admin/cores?action=STATUS&core=${CORE}&wt=xml" |grep -o '<long name="uptime">'`
Expand Down

0 comments on commit 58e37b4

Please sign in to comment.