diff --git a/deployment/deploy_openshift.sh b/deployment/deploy_openshift.sh index 4b7f03b..5892740 100755 --- a/deployment/deploy_openshift.sh +++ b/deployment/deploy_openshift.sh @@ -1,22 +1,32 @@ +#!/bin/bash +# ------------------------------------------------------------------- +# CONFIGURATION +# ------------------------------------------------------------------- INI_DIR=app-root/runtime/repo/ INI_FILE=mapif.ini APP=mapif BRANCH=master - +# ------------------------------------------------------------------- +# FUNCTIONS +# ------------------------------------------------------------------- colecho() { echo -e "\033[${1}m[deploy_openshift]> ${2}\033[0m"; } becho() { colecho 34 "${1}"; } gecho() { colecho 32 "${1}"; } recho() { colecho 31 "${1}"; } ok() { gecho "done."; } ko() { recho "failed!"; } - +# ------------------------------------------------------------------- +# MAIN SCRIPT +# ------------------------------------------------------------------- becho "calling git to push latest commit to openshift..." (git push openshift ${BRANCH} && ok) ||ko +becho "calling rhc to stop app..." +(sudo rhc app stop -a ${APP} && ok) ||ko becho "calling rhc to deploy app..." (sudo rhc deploy ${BRANCH} -a ${APP} && ok) ||ko becho "calling rhc to send configuration file to openshift..." (sudo rhc scp ${APP} upload ${INI_FILE} ${INI_DIR} && ok) ||ko -becho "calling rhc to restart application..." -(sudo rhc app restart -a ${APP} && ok) ||ko +#becho "calling rhc to restart application..." +#(sudo rhc app restart -a ${APP} && ok) ||ko becho "calling rhc to read logs after deployement..." (sudo rhc tail -a ${APP} && ok) ||ko diff --git a/src/mapif.py b/src/mapif.py index 4d4c4f1..84c4ce7 100644 --- a/src/mapif.py +++ b/src/mapif.py @@ -411,7 +411,8 @@ def location_create(): content['osm_id'] = "Le champ osm_id doit être un identifiant numérique !" if validator.is_empty(osm_type): content['osm_type'] = "Le champ osm_type ne doit pas être vide !" - # aucune validation concernant les métadonnées (explicite) + if metadata['reason'] not in ['no', 'internship', 'exchange', 'dd', 'job']: + content['meta']['reason'] = "La valeur de la métadonnée raison est invalide." if len(content.keys()) == 0: # create user - location mapping record in db content = "L'ajout de la localisation a échoué. La localisation n'a pas été confirmée par Nominatim." diff --git a/src/static/js/modules/AjaxModule.js b/src/static/js/modules/AjaxModule.js index a91b446..b2922f1 100644 --- a/src/static/js/modules/AjaxModule.js +++ b/src/static/js/modules/AjaxModule.js @@ -101,12 +101,12 @@ var AjaxModule = { location.reload(true); } else{ - alert("une erreur est survenue has_error") + UtilsModule.handleServerError("N0M1N4T1M."+osm_id); } }, error: function(resp, statut, erreur){ jsonResp = JSON.parse(resp.responseText); - UtilsModule.handleServerError(jsonResp.code) + UtilsModule.handleServerError(jsonResp.code); UtilsModule.logger("AJAX NOK"); }, complete: function(){ @@ -170,4 +170,4 @@ var AjaxModule = { } }); } -}; \ No newline at end of file +}; diff --git a/src/templates/modals/addPositionModal.html b/src/templates/modals/addPositionModal.html index 465042e..1e04437 100644 --- a/src/templates/modals/addPositionModal.html +++ b/src/templates/modals/addPositionModal.html @@ -25,7 +25,7 @@