From ffcb75ef1267b1f6e08d8ee189a2fb7ef9be6c65 Mon Sep 17 00:00:00 2001 From: James Drummond PE Date: Thu, 18 Jan 2018 11:00:25 -0600 Subject: [PATCH] Cleanup and Roll Update not working. (#8357) Cleanup and Roll Update not working due to PR #8158 exiting if existing project is not found. Moved command checking above project creation/check so that these commands can execute before scripts exits when it finds that project with the same name exists. (#8357) Signed-off-by: James Drummond --- .../openshift/files/scripts/deploy_che.sh | 48 +++++++++---------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/dockerfiles/init/modules/openshift/files/scripts/deploy_che.sh b/dockerfiles/init/modules/openshift/files/scripts/deploy_che.sh index 2dee61f64f..7acc33e036 100755 --- a/dockerfiles/init/modules/openshift/files/scripts/deploy_che.sh +++ b/dockerfiles/init/modules/openshift/files/scripts/deploy_che.sh @@ -271,6 +271,30 @@ else fi echo "done!" +# ------------------------------------------------------------- +# If command == cleanup then delete all openshift objects +# ------------------------------------------------------------- +if [ "${COMMAND}" == "cleanup" ]; then + echo "[CHE] Deleting all OpenShift objects..." + oc delete all --all + echo "[CHE] Cleanup successfully started. Use \"oc get all\" to verify that all resources have been deleted." + exit 0 +# ------------------------------------------------------------- +# If command == rollupdate then update Che +# ------------------------------------------------------------- +elif [ "${COMMAND}" == "rollupdate" ]; then + echo "[CHE] Update CHE pod" + get_che_pod_config | oc apply -f - + echo "[CHE] Update successfully started" + exit 0 +# ---------------------------------------------------------------- +# At this point command should be "deploy" otherwise it's an error +# ---------------------------------------------------------------- +elif [ "${COMMAND}" != "deploy" ]; then + echo "[CHE] **ERROR**: Command \"${COMMAND}\" is not a valid command. Aborting." + exit 1 +fi + # -------------------------- # Create project (if needed) # -------------------------- @@ -357,30 +381,6 @@ else CHE_KEYCLOAK_CLIENT__ID=${CHE_KEYCLOAK_CLIENT__ID:-"openshiftio-public"} fi -# ------------------------------------------------------------- -# If command == cleanup then delete all openshift objects -# ------------------------------------------------------------- -if [ "${COMMAND}" == "cleanup" ]; then - echo "[CHE] Deleting all OpenShift objects..." - oc delete all --all - echo "[CHE] Cleanup successfully started. Use \"oc get all\" to verify that all resources have been deleted." - exit 0 -# ------------------------------------------------------------- -# If command == rollupdate then update Che -# ------------------------------------------------------------- -elif [ "${COMMAND}" == "rollupdate" ]; then - echo "[CHE] Update CHE pod" - get_che_pod_config | oc apply -f - - echo "[CHE] Update successfully started" - exit 0 -# ---------------------------------------------------------------- -# At this point command should be "deploy" otherwise it's an error -# ---------------------------------------------------------------- -elif [ "${COMMAND}" != "deploy" ]; then - echo "[CHE] **ERROR**: Command \"${COMMAND}\" is not a valid command. Aborting." - exit 1 -fi - # ------------------------------------------------------------- # Verify that Che ServiceAccount has admin rights at project level # -------------------------------------------------------------