X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=jjb%2Fopendaylight-infra-stack.sh;h=dd731f1ac4b034609f0b153ce0a7d9f213f092d9;hb=347dd3417f85f06c999e7e9059de4df34bf57589;hp=ae190704da87856fb134395bf516ef175d378638;hpb=083016bc16594ec6b46843ff1484ad2d9774d2c6;p=releng%2Fbuilder.git diff --git a/jjb/opendaylight-infra-stack.sh b/jjb/opendaylight-infra-stack.sh index ae190704d..dd731f1ac 100644 --- a/jjb/opendaylight-infra-stack.sh +++ b/jjb/opendaylight-infra-stack.sh @@ -1,7 +1,7 @@ #!/bin/bash -virtualenv "$WORKSPACE/.venv-openstack" -# shellcheck disable=SC1090 -source "$WORKSPACE/.venv-openstack/bin/activate" +virtualenv "/tmp/v/openstack" +# shellcheck source=/tmp/v/openstack/bin/activate disable=SC1091 +source "/tmp/v/openstack/bin/activate" pip install --upgrade pip pip install --upgrade python-openstackclient python-heatclient pip freeze @@ -22,7 +22,6 @@ echo "Trying up to $STACK_RETRIES times to create $STACK_NAME." for try in $(seq $STACK_RETRIES); do # shellcheck disable=SC1083 openstack stack create --timeout "$OS_TIMEOUT" -t {stack-template} -e "$WORKSPACE/opendaylight-infra-environment.yaml" --parameter "job_name=$VM_NAME" --parameter "silo=$SILO" "$STACK_NAME" - openstack stack list echo "$try: Waiting for $OS_TIMEOUT minutes to create $STACK_NAME." for i in $(seq $OS_TIMEOUT); do sleep 60 @@ -37,7 +36,6 @@ for try in $(seq $STACK_RETRIES); do ;; CREATE_FAILED) echo "ERROR: Failed to initialize infrastructure. Deleting stack and possibly retrying to create..." - openstack stack list openstack stack delete --yes "$STACK_NAME" openstack stack show "$STACK_NAME" # after stack delete, poll for 10m to know when stack is fully removed @@ -49,7 +47,15 @@ for try in $(seq $STACK_RETRIES); do echo "$j: $STACK_SHOW" if [[ $STACK_SHOW == *"DELETE_FAILED"* ]]; then echo "stack delete failed. trying to stack abandon now" - openstack stack abandon "$STACK_NAME" + # stack abandon does not work on RS, therefore requires acquiring a token + # and using http delete method to abondon DELETE_FAILED stacks + # Todo: remove the change once RS fixes the issue upstream + # openstack stack abandon "$STACK_NAME" + STACK_ID=$(openstack stack show -f json -c "id" "$STACK_NAME" | jq -r '."id"') + TOKEN=$(openstack token issue -f json -c id | jq -r '.id') + curl -si -X DELETE -H "Content-Type: application/json" -H "Accept: application/json"\ + -H "x-auth-token: $TOKEN"\ + "https://dfw.orchestration.api.rackspacecloud.com/v1/904885/stacks/$STACK_NAME/$STACK_ID/abandon" STACK_SHOW=$(openstack stack show "$STACK_NAME") echo "$STACK_SHOW" fi @@ -72,7 +78,10 @@ for try in $(seq $STACK_RETRIES); do ;; *) echo "Unexpected status: $OS_STATUS" - exit 1 + # DO NOT exit on unexpected status. Rackspace sometimes returns unexpected status + # before returning an expected status. Just print the message and loop until we have + # a confirmed state or timeout. + # exit 1 ;; esac done