[FIX] Launch script: multiple error by using GISSMO_CFG feature.

This commit is contained in:
Olivier DOSSMANN 2016-01-14 11:25:02 +01:00
parent 437bc2cdc3
commit b64ac9f517

View File

@ -183,7 +183,7 @@ dev() {
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -v ${GISSMO_DIR}:/opt/gissmo --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} development || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container." $docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -v ${GISSMO_DIR}:/opt/gissmo --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} development || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
else else
error_and_quit "${GISSMO_DOCKER_NAME} is already launched!" error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need another name please set GISSMO_DOCKER_NAME in configuration file."
fi fi
} }
@ -218,7 +218,7 @@ init() {
} }
test_migrate() { test_migrate() {
test_start test_initial_start
} }
migrate() { migrate() {
@ -253,6 +253,9 @@ test_initial_start() {
if test -z "$GISSMO_VERSION"; then if test -z "$GISSMO_VERSION"; then
error_and_quit "No Gissmo version given (GISSMO_VERSION in config file)." error_and_quit "No Gissmo version given (GISSMO_VERSION in config file)."
fi fi
if ! test -f "$DOCKERFILE"; then
error_and_quit "Docker file don't exists: ${DOCKERFILE}"
fi
if test -z "$GISSMO_DOCKER_PORT"; then if test -z "$GISSMO_DOCKER_PORT"; then
error_and_quit "No Gissmo Docker container port given (GISSMO_DOCKER_PORT in config file)." error_and_quit "No Gissmo Docker container port given (GISSMO_DOCKER_PORT in config file)."
fi fi
@ -264,7 +267,7 @@ initial_start() {
# Build Gissmo Docker images if missing # Build Gissmo Docker images if missing
if [[ "$($docker_cmd images -q gissmo:${GISSMO_VERSION} 2> /dev/null)" == "" ]]; then if [[ "$($docker_cmd images -q gissmo:${GISSMO_VERSION} 2> /dev/null)" == "" ]]; then
cd $GISSMO_DIR cd $GISSMO_DIR
$docker_cmd build -t gissmo:${GISSMO_VERSION} . || error_and_quit "Failed to build Gissmo Docker container." $docker_cmd build -t gissmo:${GISSMO_VERSION} -f ${DOCKERFILE} || error_and_quit "Failed to build Gissmo Docker container."
cd $CURRENT_DIR cd $CURRENT_DIR
fi fi
# Check postgreSQL Docker container exists and is launched. # Check postgreSQL Docker container exists and is launched.
@ -281,7 +284,7 @@ start() {
if [ $? -eq 1 ]; then if [ $? -eq 1 ]; then
$docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -e SECRET_KEY="abcdefg" --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} $ARGS || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container." $docker_cmd run -it --rm --link ${POSTGRES_DOCKER_NAME}:db -p ${GISSMO_DOCKER_PORT}:8000 -e SECRET_KEY="abcdefg" --name ${GISSMO_DOCKER_NAME} gissmo:${GISSMO_VERSION} $ARGS || error_and_quit "Failed to create and launch ${GISSMO_DOCKER_NAME} container."
else else
error_and_quit "${GISSMO_DOCKER_NAME} is already launched!" error_and_quit "${GISSMO_DOCKER_NAME} is already launched! If you need another name please set GISSMO_DOCKER_NAME in configuration file."
fi fi
} }
@ -317,10 +320,6 @@ if test -z $DOCKERFILE_NAME; then
error_and_quit "No docker filename given." error_and_quit "No docker filename given."
fi fi
if ! test -f $DOCKERFILE && ! test "$COMMAND" == "init"; then
error_and_quit "Docker file don't exists: ${DOCKERFILE}"
fi
if ! test -z $COMMAND; then if ! test -z $COMMAND; then
check_command "$COMMAND" check_command "$COMMAND"
$COMMAND $COMMAND