forked from ISTI-ansible-roles/ansible-roles
library/roles/smartgears/smartgears/templates/get-scopes.j2: Fix the case when we are upgrading but we cannot get the state from the IS. In that case, we request new tokens to the IS.
This commit is contained in:
parent
cc10698ecb
commit
f4bbb267ab
|
@ -65,14 +65,11 @@ HTTP_PORT={{ item.http_port }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
if [ $USE_SAVED_STATE -ne 0 ] ; then
|
function get_scopes_from_auth() {
|
||||||
logger "$LOG_PREFIX First installation or moving avay to a configuration that needs to be present on all the VREs. Using our scopes list and not the state memorized one"
|
|
||||||
for jar in $( ls -1 /home/gcube/tomcat/lib/ ) ; do
|
for jar in $( ls -1 /home/gcube/tomcat/lib/ ) ; do
|
||||||
export CLASSPATH="/home/gcube/SmartGears/lib/${jar}:$CLASSPATH"
|
export CLASSPATH="/home/gcube/SmartGears/lib/${jar}:$CLASSPATH"
|
||||||
done
|
done
|
||||||
|
|
||||||
cd $LOCAL_LIB
|
cd $LOCAL_LIB
|
||||||
|
|
||||||
java TokenGenerator {{ smartgears_hostname }} $TOKEN $HTTP_PORT $SCOPES_FILE $SCOPES_LIST >/dev/null 2>&1
|
java TokenGenerator {{ smartgears_hostname }} $TOKEN $HTTP_PORT $SCOPES_FILE $SCOPES_LIST >/dev/null 2>&1
|
||||||
RETVAL=$?
|
RETVAL=$?
|
||||||
if [ $RETVAL -eq 0 ] ; then
|
if [ $RETVAL -eq 0 ] ; then
|
||||||
|
@ -81,6 +78,11 @@ if [ $USE_SAVED_STATE -ne 0 ] ; then
|
||||||
logger "$LOG_PREFIX Unable to obtain the scope tokens, aborting"
|
logger "$LOG_PREFIX Unable to obtain the scope tokens, aborting"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ $USE_SAVED_STATE -ne 0 ] ; then
|
||||||
|
logger "$LOG_PREFIX First installation or moving avay to a configuration that needs to be present on all the VREs. Using our scopes list and not the state memorized one"
|
||||||
|
get_scopes_from_auth
|
||||||
else
|
else
|
||||||
logger "$LOG_PREFIX We are going to use the scopes memorized into the state"
|
logger "$LOG_PREFIX We are going to use the scopes memorized into the state"
|
||||||
SCOPES_FILE=$SMARTGEARS_SAVED_STATE_PATH
|
SCOPES_FILE=$SMARTGEARS_SAVED_STATE_PATH
|
||||||
|
@ -90,6 +92,13 @@ fi
|
||||||
cd $SMARTGEARS_SCRIPTS_DIR
|
cd $SMARTGEARS_SCRIPTS_DIR
|
||||||
. $GHN_ENV_FILE
|
. $GHN_ENV_FILE
|
||||||
./clean-container-state -s $SMARTGEARS_SAVED_STATE_F
|
./clean-container-state -s $SMARTGEARS_SAVED_STATE_F
|
||||||
|
RETVAL=$?
|
||||||
|
if [ $RETVAL -ne 0 ] ; then
|
||||||
|
# We were not able to get the running state from the IS. We get new ones
|
||||||
|
logger "$LOG_PREFIX We were not able to get the running state from the IS. We get new ones from the authorization service"
|
||||||
|
SCOPES_FILE={{ smartgears_user_home }}/.containerxml/2-container.xml
|
||||||
|
get_scopes_from_auth
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Now that we have the tokens, we can assemble the container.xml file
|
# Now that we have the tokens, we can assemble the container.xml file
|
||||||
|
|
Loading…
Reference in New Issue