Dataminer: Remove the list of installed algorithms after an upgrade to force a reinstall.

This commit is contained in:
Andrea Dell'Amico 2018-04-05 16:14:37 +02:00
parent 370d3b90be
commit 3cc7c27af8
2 changed files with 17 additions and 12 deletions

View File

@ -11,7 +11,7 @@
- dataminer_app_upgrade - dataminer_app_upgrade
tags: [ 'tomcat', 'dataminer', 'wps' ] 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: - block:
- name: Remove the old dataminer algorithm installer to force an upgrade - name: Remove the old dataminer algorithm installer to force an upgrade
file: path={{ smartgears_user_home }}/algorithmInstaller state=absent file: path={{ smartgears_user_home }}/algorithmInstaller state=absent
@ -40,6 +40,7 @@
- name: Unarchive the dataminer_wps war - 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' 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 notify: Restart smartgears
- name: Install the dataminer web.xml - 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 template: src=wps-config-fixer.j2 dest=/usr/local/bin/wps-config-fixer owner=root group=root mode=0555
with_items: '{{ tomcat_m_instances }}' 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 - name: Fix the WPS config file
shell: /usr/local/bin/wps-config-fixer shell: /usr/local/bin/wps-config-fixer
# notify: Restart smartgears # 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 - name: Install the nscd service to work around dns timeouts
become_user: root become_user: root
apt: pkg=nscd state=present update_cache=yes cache_valid_time=1800 apt: pkg=nscd state=present update_cache=yes cache_valid_time=1800

View File

@ -42,10 +42,10 @@ create_log_dir() {
check_lock_file() { check_lock_file() {
# Create the lock file # Create the lock file
if [ -f $LOCK_FILE ] ; then if [ -f "$LOCK_FILE" ] ; then
set +o pipefail set +o pipefail
set +e set +e
OLDPROC=$( cat $LOCK_FILE ) OLDPROC=$( cat "$LOCK_FILE" )
OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' ) OLDPROC_RUNNING=$( ps auwwx | grep -v grep | grep $OLDPROC | awk '{ print $2 }' )
RUNNING_JOB_RETVAL=$? RUNNING_JOB_RETVAL=$?
if [ ! -z "$OLDPROC_RUNNING" ] ; then if [ ! -z "$OLDPROC_RUNNING" ] ; then
@ -69,7 +69,7 @@ create_log_dir() {
fi fi
set -o pipefail set -o pipefail
set -e set -e
echo "$PROCNUM" > $LOCK_FILE echo "$PROCNUM" > "$LOCK_FILE"
} }
update_svn_repo() { update_svn_repo() {
@ -209,8 +209,14 @@ create_log_dir
check_lock_file check_lock_file
update_svn_repo update_svn_repo
if [ $SVN_UPDATE_STATUS -ne 0 ] ; then if [ $SVN_UPDATE_STATUS -ne 0 ] ; then
logger "algorithms-updater: nothing new to from SVN, exiting." if [ -d "${LOG_DIR}" ] ; then
cleanup 0 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 fi
sort_installed_algo_file sort_installed_algo_file
algorithms_updater algorithms_updater