Change the algorithms-updater script so that it installs some missing algorithms even when there is no update from subversion.

This commit is contained in:
Andrea Dell'Amico 2019-02-06 15:45:57 +01:00
parent 9aba15c7b2
commit dd6442e8dd
1 changed files with 11 additions and 5 deletions

View File

@ -7,7 +7,7 @@ PROCNUM=$$
INFRA_REFERENCE={{ dataminer_infra_reference }}
ADD_ALGORITHM_DIR={{ smartgears_user_home }}/algorithmInstaller
ADD_ALGORITHM_PATH={{ smartgears_user_home }}/algorithmInstaller/addAlgorithm.sh
ALGORITHMS_FILE={{ dataminer_wps_algorithms_dest }}/${INFRA_REFERENCE}/algorithms
ALGORITHMS_FILE="{{ dataminer_wps_algorithms_dest }}/${INFRA_REFERENCE}/algorithms"
OUT_DIR=$( mktemp -d -t algorithms-updater.XXXXXXXXXX )
ALGORITHMS_TEMP_SCRIPT=$OUT_DIR/add_algorithms
LOG_DIR={{ smartgears_user_home }}/wps_algorithms_install_log
@ -19,6 +19,8 @@ ALGO_BASE_DIR={{ dataminer_wps_algorithms_dest }}
ALGO_DIR=${ALGO_BASE_DIR}/${INFRA_REFERENCE}
SVN_ALGORITHMS_URL={{ dataminer_wps_algorithms_svn }}
SVN_UPDATE_STATUS=
SVN_ALGORITHMS_NUM=
INSTALLED_ALGORITHMS_NUM=
# In seconds. 60*60*6=21600s (6h)
UPDATER_PROCESS_MAX_RUNTIME=21600
OLDPROC=
@ -206,13 +208,17 @@ update_svn_repo() {
create_log_dir
check_lock_file
update_svn_repo
SVN_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_FILE" | awk '{print $1}' )
INSTALLED_ALGORITHMS_NUM=$( wc -l "$ALGORITHMS_INSTALLED_FILE" | awk '{print $1}' )
if [ $SVN_UPDATE_STATUS -ne 0 ] ; then
if [ -d "${LOG_DIR}" ] ; then
if [ ! -f "$ALGORITHMS_INSTALLED_FILE" ] || [ ! -s "$ALGORITHMS_INSTALLED_FILE" ] ; then
logger "algorithms-updater: nothing new to from SVN but the file that lists the installed algorithms does not exist or is empty. We are going to reinstall all the algorithms."
else
logger "algorithms-updater: nothing new to from SVN, exiting."
cleanup 0
logger "algorithms-updater: nothing new to from SVN but the file that lists the installed algorithms does not exist or is empty. We are going to reinstall all the algorithms."
elif [ $SVN_ALGORITHMS_NUM -gt $INSTALLED_ALGORITHMS_NUM ] ; then
logger "algorithms-updater: nothing new to from SVN but the installed algorithms are less than the expected number. We are going to run the installer."
else
logger "algorithms-updater: nothing new to from SVN and all the algorithms are installed, exiting."
cleanup 0
fi
fi
fi