This patch will make the post build cleanup script only clear
stacks with CREATE_COMPLETE and CREATE_FAILED statuses.
Let the periodic cleanup job clear CREATE_FAILED and DELETE_FAILED
statuses. This is to help Rackspace troubleshoot our orchestration
stacks getting stuck in Rackspace.
Change-Id: I6fe75fe380508533bd440297e32bdddce2a7cc71
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
- shell: |
if [ -d "$WORKSPACE/.venv-openstack" ]; then
source $WORKSPACE/.venv-openstack/bin/activate
- openstack --os-cloud rackspace stack delete --yes $STACK_NAME
+ OS_STATUS=`openstack --os-cloud rackspace stack show -f json -c stack_status $STACK_NAME | jq -r '.stack_status'`
+ if [ "$OS_STATUS" == "CREATE_COMPLETE" ] || [ "$OS_STATUS" == "CREATE_FAILED" ]; then
+ echo "Deleting $STACK_NAME"
+ openstack --os-cloud rackspace stack delete --yes $STACK_NAME
+ fi
fi
- shell: !include-raw: include-raw-deploy-archives.sh
- maven-target: