diff options
Diffstat (limited to 'utils/infra_setup/heat_template')
-rwxr-xr-x | utils/infra_setup/heat_template/HOT_create_instance.sh | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/utils/infra_setup/heat_template/HOT_create_instance.sh b/utils/infra_setup/heat_template/HOT_create_instance.sh index aa4e2e32..9d80022d 100755 --- a/utils/infra_setup/heat_template/HOT_create_instance.sh +++ b/utils/infra_setup/heat_template/HOT_create_instance.sh @@ -37,17 +37,21 @@ bottlenecks_create_instance() bottlenecks_cleanup() { - echo "clean up bottlenecks images" + echo "clean up bottlenecks images and keys" - if ! glance image-list; then - return + if glance image-list; then + for image in $(glance image-list | grep -e $IMAGE_NAME | awk '{print $2}'); do + echo "clean up image $image" + glance image-delete $image || true + done fi - #need to check - for image in $(glance image-list | grep -e $IMAGE_NAME | awk '{print $2}'); do - echo "clean up image $image" - glance image-delete $iamge || true - done + if nova keypair-list; then + for key in $(nova keypair-list | grep -e $KEY_NAME | awk '{print $2}'); do + echo "clean up key $key" + nova keypair-delete || true + done + fi } bottlenecks_build_image() @@ -122,7 +126,7 @@ main() #IMAGE_FILE_NAME="" bottlenecks_env_prepare - #bottlenecks_cleanup + bottlenecks_cleanup #bottlenecks_build_image bottlenecks_load_cirros_image bottlenecks_create_instance |