library/roles/smartgears/smartgears_egi_image: Fix the smartgears setup, again.

This commit is contained in:
Andrea Dell'Amico 2016-11-16 17:24:19 +01:00
parent 7064bc2af4
commit 7d556bcd6c
1 changed files with 13 additions and 1 deletions

View File

@ -9,6 +9,7 @@ SM_CONF_DEST_F=${SM_DIR}/container.xml
SM_LIB_DIR=${SM_DIR}/lib
SM_STATE_DIR=${SM_DIR}/state/
GET_KEYS_SCRIPT=/usr/local/bin/get-gcube-keys
GET_SCOPES_SCRIPT=/usr/local/bin/get-scopes
SVC=tomcat-instance-{{ smartgears_http_port }}
TOMCAT_DEFAULT=/etc/default/${SVC}
LOG_FILE=/var/log/smartgears-node-setup.log
@ -127,6 +128,16 @@ function set_scopes_list() {
echo "SCOPES_LIST='${SMARTGEARS_SCOPES}'" > $SM_CONF_SCOPES_F
}
function fix_get_scopes() {
echo "-- fix_get_scopes" >> $LOG_FILE
# We use the public FQDN if there's one. Otherwise we use the public IP
if [ ! -z ${PUB_FQDN_HOST} ] ; then
sed -i -e "s#@SMARTGEARS_HOSTNAME@#${PUB_FQDN_HOST}#g" $GET_SCOPES_SCRIPT
else
sed -i -e "s#@SMARTGEARS_HOSTNAME@#${PUBLIC_IP}#g" $GET_SCOPES_SCRIPT
fi
}
function get_smartgears_scope_tokens() {
# The SMARTGEARS_TOKEN variable need to be set outside the contextualization script
echo "-- get_smartgears_scope_tokens" >> $LOG_FILE
@ -134,7 +145,7 @@ function get_smartgears_scope_tokens() {
echo "No infrastructure token was passed, aborting" >> $LOG_FILE
echo "" > $SM_CONF_TOKENS_F
else
/usr/local/bin/get-scopes $( echo ${SMARTGEARS_TOKEN}) >> $LOG_FILE
$GET_SCOPES_SCRIPT $( echo ${SMARTGEARS_TOKEN}) >> $LOG_FILE
fi
}
@ -192,6 +203,7 @@ modify_hosts_file
smartgears_config_parameters_check
set_scopes_list
populate_head_containerxml
fix_get_scopes
get_smartgears_scope_tokens
merge_container_xml
get_gcube_keys