diff --git a/smartgears/dataminer_app/tasks/dataminer-app.yml b/smartgears/dataminer_app/tasks/dataminer-app.yml index 5da3640..767448c 100644 --- a/smartgears/dataminer_app/tasks/dataminer-app.yml +++ b/smartgears/dataminer_app/tasks/dataminer-app.yml @@ -11,7 +11,7 @@ - dataminer_app_upgrade tags: [ 'tomcat', 'dataminer', 'wps' ] -# This is only needed to force an upgrade +# This is only needed to force an upgrade of the algorithm importer script - block: - name: Remove the old dataminer algorithm installer to force an upgrade file: path={{ smartgears_user_home }}/algorithmInstaller state=absent @@ -40,6 +40,7 @@ - name: Unarchive the dataminer_wps war unarchive: copy=no src={{ smartgears_downloads_dir }}/{{ dataminer_wps_file }} dest={{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }} creates='{{ smartgears_instance_path }}/webapps/{{ dataminer_wps_name }}/WEB-INF/lib' + register: dataminer_updated notify: Restart smartgears - name: Install the dataminer web.xml @@ -116,16 +117,14 @@ template: src=wps-config-fixer.j2 dest=/usr/local/bin/wps-config-fixer owner=root group=root mode=0555 with_items: '{{ tomcat_m_instances }}' - - name: Remove the catalina additional configuration - #template: src={{ dataminer_wps_name }}.xml.j2 dest={{ item.instance_path }}/conf/Catalina/localhost/{{ dataminer_wps_name }}.xml - file: dest={{ item.instance_path }}/conf/Catalina/localhost/{{ dataminer_wps_name }}.xml state=absent - with_items: '{{ tomcat_m_instances }}' - notify: Restart smartgears - - name: Fix the WPS config file shell: /usr/local/bin/wps-config-fixer # notify: Restart smartgears + - name: Remove the file that lists the installed algorithms, after an upgrade + file: dest={{ smartgears_user_home }}/wps_algorithms_install_log/already_installed_algorithms.txt state=absent + when: dataminer_updated is changed + - name: Install the nscd service to work around dns timeouts become_user: root apt: pkg=nscd state=present update_cache=yes cache_valid_time=1800 diff --git a/smartgears/dataminer_app/templates/algorithms-updater.j2 b/smartgears/dataminer_app/templates/algorithms-updater.j2 index 2c07d09..1cd861e 100644 --- a/smartgears/dataminer_app/templates/algorithms-updater.j2 +++ b/smartgears/dataminer_app/templates/algorithms-updater.j2 @@ -42,10 +42,10 @@ create_log_dir() { check_lock_file() { # Create the lock file - if [ -f $LOCK_FILE ] ; then + if [ -f "$LOCK_FILE" ] ; then set +o pipefail set +e - OLDPROC=$( cat $LOCK_FILE ) + OLDPROC=$( cat "$LOCK_FILE" ) OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' ) RUNNING_JOB_RETVAL=$? if [ ! -z "$OLDPROC_RUNNING" ] ; then @@ -69,7 +69,7 @@ create_log_dir() { fi set -o pipefail set -e - echo "$PROCNUM" > $LOCK_FILE + echo "$PROCNUM" > "$LOCK_FILE" } update_svn_repo() { @@ -209,8 +209,14 @@ create_log_dir check_lock_file update_svn_repo if [ $SVN_UPDATE_STATUS -ne 0 ] ; then - logger "algorithms-updater: nothing new to from SVN, exiting." - cleanup 0 + if [ -d "${LOG_DIR}" ] ; then + if [ ! -f "$ALGORITHMS_INSTALLED_FILE" ] ; then + logger "algorithms-updater: nothing new to from SVN but the file that lists the installed algorithms does not exist. We are going to reinstall all the algorithms." + else + logger "algorithms-updater: nothing new to from SVN, exiting." + cleanup 0 + fi + fi fi sort_installed_algo_file algorithms_updater