diff options
author | MatthewLi <matthew.lijun@huawei.com> | 2015-12-22 09:44:33 +0000 |
---|---|---|
committer | MatthewLi <matthew.lijun@huawei.com> | 2015-12-22 09:47:38 +0000 |
commit | 59ddd38d8c331c94eca6485451bc0cb61e09b629 (patch) | |
tree | 6291ef93a0b677371c28e14825e79bc837d2770f /utils/infra_setup/heat_template | |
parent | 971eae7ded51ed3926b0e923e920c1926c71e5ab (diff) |
amend heat template instance creation script
JIRA: BOTTLENECK-35
Change-Id: I157ba0f81c51320979094c6e6a3528b69e54b07c
Signed-off-by: MatthewLi <matthew.lijun@huawei.com>
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 |