4d0f6329df
Running quickstart with OVB needs to work with multiple host clouds where different flavor sets are available. This review: * Adds variables to the flavor specifications so that they can be overwritten by config files per host cloud environment * Adds functionality to clean up stacks and keypairs from the host cloud environment * Includes cloning the Openstack Virtual Baremetal repo within the ovb-manage-stack role * Deletes the clouds.yaml file so it is not available, with the tenant password exposed for longer than necessary to create or delete the stack * Changes the default key location to use the user's default key on the undercloud Change-Id: I5f0f7327a2509ef889b80a35024478b13df2c2a9
49 lines
1.5 KiB
Django/Jinja
49 lines
1.5 KiB
Django/Jinja
#!/bin/bash
|
|
|
|
set -eux
|
|
|
|
### --start_docs
|
|
|
|
## --------------------------------------------------------------
|
|
## Clean up the OVB environment by removing stacks and key pairs
|
|
## --------------------------------------------------------------
|
|
|
|
## ##################################################
|
|
## Find the existing stacks and keys pairs to delete
|
|
## ##################################################
|
|
|
|
## * Return all stacks in COMPLETE or CREATE_FAILED state
|
|
## ::
|
|
|
|
ALL_STACKS=$({{ local_working_dir }}/bin/openstack stack list | grep "COMPLETE\|CREATE_FAILED" | cut -d '|' -f 3)
|
|
|
|
## * Delete stacks in COMPLETE or CREATE_FAILED state - one stack at a time
|
|
## ::
|
|
|
|
for STACK in $ALL_STACKS; do
|
|
echo "Deleting Heat stack $STACK"
|
|
{{ local_working_dir }}/bin/openstack stack delete --yes $STACK
|
|
COUNTER=0
|
|
while [[ $({{ local_working_dir }}/bin/openstack stack list) == *"$STACK"* ]]; do
|
|
if [[ $COUNTER -gt 6 ]]; then
|
|
echo "$STACK could not be deleted in time or is in FAILED state."
|
|
exit 1
|
|
else
|
|
echo "Polling for stack $STACK to be deleted"
|
|
sleep 30
|
|
COUNTER=$((COUNTER+1))
|
|
fi
|
|
done
|
|
|
|
## * Delete the key pair associated with the stack
|
|
## ::
|
|
|
|
KEYPAIR=$(echo ${STACK/stack/key} | sed 's/oooq-//')
|
|
if [[ $({{ local_working_dir }}/bin/nova keypair-list) == *"$KEYPAIR"* ]]; then
|
|
echo "Deleting key pair $KEYPAIR"
|
|
{{ local_working_dir }}/bin/nova keypair-delete $KEYPAIR
|
|
fi
|
|
done
|
|
|
|
### --stop_docs
|